commit | 99d0b200e922806bcfb985374d0c7c1b30c6f956 | [log] [tgz] |
---|---|---|
author | Pingping Lin <pingping@onlab.us> | Tue May 05 14:08:48 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Tue May 05 23:22:12 2015 +0000 |
tree | 589ad6c5fc18f23c282c684a49534f7bf8d7c106 | |
parent | 8eb12a26a943f1145f68fa2958dc4aef27f29679 [diff] |
thread safe improvment Change-Id: I09b6dc7a3003792ec975b5b8c8c423d38d65767b
diff --git a/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngConfigurationManager.java b/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngConfigurationManager.java index 41ff0b4..fe0edd2 100644 --- a/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngConfigurationManager.java +++ b/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngConfigurationManager.java
@@ -112,7 +112,8 @@ // TODO handle the case: the number of public IP addresses is not enough // for 1:1 mapping from public IP to private IP. @Override - public IpAddress getAvailablePublicIpAddress(IpAddress privateIpAddress) { + public synchronized IpAddress getAvailablePublicIpAddress(IpAddress + privateIpAddress) { // If there is already a mapping entry for the private IP address, // then fetch the public IP address in the mapping entry and return it. IpAddress publicIpAddress = ipAddressMap.get(privateIpAddress);
diff --git a/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngResource.java b/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngResource.java index c38b7a7..9436981 100644 --- a/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngResource.java +++ b/apps/virtualbng/src/main/java/org/onosproject/virtualbng/VbngResource.java
@@ -47,10 +47,8 @@ VbngService vbngService = get(VbngService.class); IpAddress publicIpAddress = null; - synchronized (this) { - // Create a virtual BNG - publicIpAddress = vbngService.createVbng(privateIpAddress); - } + // Create a virtual BNG + publicIpAddress = vbngService.createVbng(privateIpAddress); if (publicIpAddress != null) { return publicIpAddress.toString();