Fix logic that checks if the request tracking ConsistentMap was updated
Change-Id: I0f7c6e8b9ee89ab8209e36b6933345375dabf477
diff --git a/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java b/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
index 450875e..27b0973 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/packet/impl/DistributedPacketStore.java
@@ -213,6 +213,9 @@
private AtomicBoolean addInternal(PacketRequest request) {
AtomicBoolean firstRequest = new AtomicBoolean(false);
requests.compute(request.selector(), (s, existingRequests) -> {
+ // Reset to false just in case this is a retry due to
+ // ConcurrentModificationException
+ firstRequest.set(false);
if (existingRequests == null) {
firstRequest.set(true);
return ImmutableSet.of(request);
@@ -239,6 +242,9 @@
private AtomicBoolean removeInternal(PacketRequest request) {
AtomicBoolean removedLast = new AtomicBoolean(false);
requests.computeIfPresent(request.selector(), (s, existingRequests) -> {
+ // Reset to false just in case this is a retry due to
+ // ConcurrentModificationException
+ removedLast.set(false);
if (existingRequests.contains(request)) {
Set<PacketRequest> newRequests = Sets.newHashSet(existingRequests);
newRequests.remove(request);