DistributedPacketStore: Retry indefinitely if consistent-map operations fail due to concurrent modification exception
Change-Id: Ibb9fd6ec65f61077cb8fa7313a350315914ea69d
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 3865a77..bab5cdf 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
@@ -68,7 +68,7 @@
private final Logger log = getLogger(getClass());
- private static final int MAX_BACKOFF = 10;
+ private static final int MAX_BACKOFF = 50;
// TODO: make this configurable.
private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 4;
@@ -177,8 +177,8 @@
private void add(PacketRequest request) {
AtomicBoolean firstRequest =
- retryable(this::addInternal, ConsistentMapException.class,
- 3, MAX_BACKOFF).apply(request);
+ retryable(this::addInternal, ConsistentMapException.ConcurrentModification.class,
+ Integer.MAX_VALUE, MAX_BACKOFF).apply(request);
if (firstRequest.get() && delegate != null) {
// The instance that makes the first request will push to all devices
delegate.requestPackets(request);
@@ -205,8 +205,8 @@
private void remove(PacketRequest request) {
AtomicBoolean removedLast =
- retryable(this::removeInternal, ConsistentMapException.class,
- 3, MAX_BACKOFF).apply(request);
+ retryable(this::removeInternal, ConsistentMapException.ConcurrentModification.class,
+ Integer.MAX_VALUE, MAX_BACKOFF).apply(request);
if (removedLast.get() && delegate != null) {
// The instance that removes the last request will remove from all devices
delegate.cancelPackets(request);