BUG-8402: Separate out OutOfOrderRequestException
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / ClientActorBehavior.java
index e70fdc9662c6232dcc81bda50d95795cca02dbde..ca78d0cb66f85a52b003757ec2c23d75c4acdc95 100644 (file)
@@ -18,6 +18,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.access.commands.NotLeaderException;
+import org.opendaylight.controller.cluster.access.commands.OutOfSequenceEnvelopeException;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.FailureEnvelope;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
@@ -175,6 +176,17 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
                 return conn.reconnect(this);
             }
         }
+        if (cause instanceof OutOfSequenceEnvelopeException) {
+            final AbstractClientConnection<T> conn = getConnection(command);
+            if (conn instanceof ReconnectingClientConnection) {
+                // Already reconnecting, do not churn the logs
+                return this;
+            } else if (conn != null) {
+                LOG.info("{}: connection {} indicated no sequencing mismatch on {} sequence {}, reconnecting it",
+                    persistenceId(), conn, failure.getTarget(), failure.getSequence(), cause);
+                return conn.reconnect(this);
+            }
+        }
 
         return onRequestFailure(command);
     }