mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 09:51:38 +02:00
Use allocateNextId when building new NextObjective
In order to avoid nextId collisions, all users of the flow objective service should use the provided allocateNextId() method when constructing new NextObjectives. I found one instance where this was not the case: CordMcast. Solution: removed private id generator from CordMacst and replaced it with allocateNextId. Change-Id: I134931b58c524291ae937dd6f0051ee549236734
This commit is contained in:
parent
d5bf1069b9
commit
05a1ba1dc9
@ -77,7 +77,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
@ -129,9 +128,6 @@ public class CordMcast {
|
||||
//TODO: move this to a ec map
|
||||
private Map<IpAddress, Integer> groups = Maps.newConcurrentMap();
|
||||
|
||||
//TODO: move this to distributed atomic long
|
||||
private AtomicInteger channels = new AtomicInteger(0);
|
||||
|
||||
private ApplicationId appId;
|
||||
|
||||
@Property(name = "mcastVlan", intValue = DEFAULT_MCAST_VLAN,
|
||||
@ -331,7 +327,7 @@ public class CordMcast {
|
||||
final AtomicBoolean sync = new AtomicBoolean(false);
|
||||
|
||||
Integer nextId = groups.computeIfAbsent(route.group(), (g) -> {
|
||||
Integer id = allocateId();
|
||||
Integer id = flowObjectiveService.allocateNextId();
|
||||
|
||||
NextObjective next = DefaultNextObjective.builder()
|
||||
.fromApp(appId)
|
||||
@ -497,10 +493,6 @@ public class CordMcast {
|
||||
mcastRoutes.forEach(this::removeRemoteRoute);
|
||||
}
|
||||
|
||||
private Integer allocateId() {
|
||||
return channels.getAndIncrement();
|
||||
}
|
||||
|
||||
private WebResource.Builder getClientBuilder(String uri) {
|
||||
Client client = Client.create();
|
||||
client.setConnectTimeout(DEFAULT_REST_TIMEOUT_MS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user