Madan Jampani
Committed by Gerrit Code Review

DistributedPacketStore: Retry indefinitely if consistent-map operations fail due…

… to concurrent modification exception

Change-Id: Ibb9fd6ec65f61077cb8fa7313a350315914ea69d
...@@ -68,7 +68,7 @@ public class DistributedPacketStore ...@@ -68,7 +68,7 @@ public class DistributedPacketStore
68 68
69 private final Logger log = getLogger(getClass()); 69 private final Logger log = getLogger(getClass());
70 70
71 - private static final int MAX_BACKOFF = 10; 71 + private static final int MAX_BACKOFF = 50;
72 72
73 // TODO: make this configurable. 73 // TODO: make this configurable.
74 private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 4; 74 private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 4;
...@@ -177,8 +177,8 @@ public class DistributedPacketStore ...@@ -177,8 +177,8 @@ public class DistributedPacketStore
177 177
178 private void add(PacketRequest request) { 178 private void add(PacketRequest request) {
179 AtomicBoolean firstRequest = 179 AtomicBoolean firstRequest =
180 - retryable(this::addInternal, ConsistentMapException.class, 180 + retryable(this::addInternal, ConsistentMapException.ConcurrentModification.class,
181 - 3, MAX_BACKOFF).apply(request); 181 + Integer.MAX_VALUE, MAX_BACKOFF).apply(request);
182 if (firstRequest.get() && delegate != null) { 182 if (firstRequest.get() && delegate != null) {
183 // The instance that makes the first request will push to all devices 183 // The instance that makes the first request will push to all devices
184 delegate.requestPackets(request); 184 delegate.requestPackets(request);
...@@ -205,8 +205,8 @@ public class DistributedPacketStore ...@@ -205,8 +205,8 @@ public class DistributedPacketStore
205 205
206 private void remove(PacketRequest request) { 206 private void remove(PacketRequest request) {
207 AtomicBoolean removedLast = 207 AtomicBoolean removedLast =
208 - retryable(this::removeInternal, ConsistentMapException.class, 208 + retryable(this::removeInternal, ConsistentMapException.ConcurrentModification.class,
209 - 3, MAX_BACKOFF).apply(request); 209 + Integer.MAX_VALUE, MAX_BACKOFF).apply(request);
210 if (removedLast.get() && delegate != null) { 210 if (removedLast.get() && delegate != null) {
211 // The instance that removes the last request will remove from all devices 211 // The instance that removes the last request will remove from all devices
212 delegate.cancelPackets(request); 212 delegate.cancelPackets(request);
......