From: Robert Varga Date: Tue, 23 May 2017 17:42:57 +0000 (+0200) Subject: BUG-8540: suppress ConnectingClientConnection backend timeout X-Git-Tag: release/carbon-sr1~61 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=a3b2c1a05f66523561a10ac898723ffdf7e68798 BUG-8540: suppress ConnectingClientConnection backend timeout While a ClientConnection is in initial connect state we do not want the timer to attempt to reconnect it, as it we are already trying hard to connect it. Suppress that attempt by faking backend silent ticks to be 0. Change-Id: Iaf554632a56fd5be1d417d6806462edf3c746526 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java index cd81a4e544..6cb89eec16 100644 --- a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java +++ b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java @@ -289,6 +289,10 @@ public abstract class AbstractClientConnection { } } + long backendSilentTicks(final long now) { + return now - lastReceivedTicks; + } + /* * We are using tri-state return here to indicate one of three conditions: * - if there is no timeout to schedule, return Optional.empty() @@ -303,7 +307,7 @@ public abstract class AbstractClientConnection { return Optional.empty(); } - final long backendSilentTicks = now - lastReceivedTicks; + final long backendSilentTicks = backendSilentTicks(now); if (backendSilentTicks >= BACKEND_ALIVE_TIMEOUT_NANOS) { LOG.debug("Connection {} has not seen activity from backend for {} nanoseconds, timing out", this, backendSilentTicks); diff --git a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ConnectingClientConnection.java b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ConnectingClientConnection.java index a36267c44f..07ef769544 100644 --- a/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ConnectingClientConnection.java +++ b/opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ConnectingClientConnection.java @@ -30,6 +30,12 @@ public final class ConnectingClientConnection extends Abs return Optional.empty(); } + @Override + long backendSilentTicks(final long now) { + // We are still connecting and do not want the timer to attempt a reconnect + return 0; + } + @Override ClientActorBehavior lockedReconnect(final ClientActorBehavior current, final RequestException cause) { throw new UnsupportedOperationException("Attempted to reconnect a connecting connection", cause);