diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ExponentialBackoffIntervalCalculator.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ExponentialBackoffIntervalCalculator.java index 7234c7b1fda..e0abb02d9f1 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ExponentialBackoffIntervalCalculator.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ExponentialBackoffIntervalCalculator.java @@ -17,15 +17,12 @@ import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.RequestConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; public class ExponentialBackoffIntervalCalculator { - private static final Logger logger = LoggerFactory.getLogger(ExponentialBackoffIntervalCalculator.class); //we were using the same default in multiple places, so it has been moved here for now private static final int MAX_RETRY_INTERVAL_EXPONENT = 5; @@ -57,9 +54,7 @@ public void resetReconnectAttempts() { public final long nextReconnectInterval() { int exponentOfTwo = currentReconnectAttempt.getAndIncrement(); - long ret = getInterval(exponentOfTwo); - logger.debug("Current reconnect backoff is {} milliseconds (T{})", ret, exponentOfTwo); - return ret; + return getInterval(exponentOfTwo); } public int getCurrentReconnectAttempt() { diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java index d25d66e6cda..44760ace0fd 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/AbstractWatchManager.java @@ -195,10 +195,10 @@ void scheduleReconnect(WatchRequestState state) { return; } - logger.debug("Scheduling reconnect task"); - long delay = nextReconnectInterval(); + logger.debug("Scheduling reconnect task in {} ms", delay); + synchronized (this) { reconnectAttempt = Utils.schedule(baseOperation.context.getExecutor(), this::reconnect, delay, TimeUnit.MILLISECONDS); if (isForceClosed()) {