synchronization modification of shared structures
@@ -760,7 +760,7 @@ public class VirtualRouter extends ComparableStructure<String> {
return false;
}
- private void markPrefix(
+ private static synchronized void markPrefix(
Prefix prefix,
BgpNeighbor neighbor,
BgpNeighbor remoteBgpNeighbor,
@@ -1194,9 +1194,11 @@ public class VirtualRouter extends ComparableStructure<String> {
}
_receivedBgpAdvertisements.add(receivedAdvert);
} else {
+ synchronized (deferredBgpAdvertisements) {
deferredBgpAdvertisements
.computeIfAbsent(neighbor, n -> new IdentityHashMap<>())
- .computeIfAbsent(remoteBgpNeighbor, n -> new LinkedList<BgpAdvertisement>())
+ .computeIfAbsent(
+ remoteBgpNeighbor, n -> new LinkedList<BgpAdvertisement>())
.add(receivedAdvert);
deferredIncomingRoutes
.computeIfAbsent(neighbor, n -> new IdentityHashMap<>())
@@ -1204,9 +1206,11 @@ public class VirtualRouter extends ComparableStructure<String> {
.add(transformedIncomingRoute);
deferredIncomingRouteRibs
.computeIfAbsent(neighbor, n -> new IdentityHashMap<>())
- .computeIfAbsent(remoteBgpNeighbor, n -> new LinkedList<BgpMultipathRib>())
+ .computeIfAbsent(
+ remoteBgpNeighbor, n -> new LinkedList<BgpMultipathRib>())
.add(targetRib);
}
+ }
} else {
if (targetRib.mergeRoute(transformedIncomingRoute)) {
numRoutes++;
