X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fcommons%2Fprotocol-framework%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fframework%2FTimedReconnectStrategy.java;h=6a1607803b9310c1a1a5a43013ff2906b38b7290;hp=ecb9e65a528a104f0e7727f45e65f97d9e583c44;hb=e2d1c4c0fb80825a35e552c78b13808fa48f9197;hpb=ee303a25aa7c90ab9f7f28c1effef5254a4c7676 diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java index ecb9e65a52..6a1607803b 100644 --- a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java +++ b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/TimedReconnectStrategy.java @@ -10,7 +10,6 @@ package org.opendaylight.protocol.framework; import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.Future; -import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -29,7 +28,7 @@ import com.google.common.base.Preconditions; * * Initial sleep time is specified as minSleep. Each subsequent unsuccessful attempt multiplies this time by a constant * factor (sleepFactor) -- this allows for either constant reconnect times (sleepFactor = 1), or various degrees of - * exponential back-off (sleepFactor > 1). Maximum sleep time between attempts can be capped to a specific value + * exponential back-off (sleepFactor > 1). Maximum sleep time between attempts can be capped to a specific value * (maxSleep). * * The strategy can optionally give up based on two criteria: @@ -129,16 +128,13 @@ public final class TimedReconnectStrategy implements ReconnectStrategy { this.scheduled = true; // Schedule a task for the right time. It will also clear the flag. - return this.executor.schedule(new Callable() { - @Override - public Void call() throws TimeoutException { - synchronized (lock) { - Preconditions.checkState(TimedReconnectStrategy.this.scheduled); - TimedReconnectStrategy.this.scheduled = false; - } - - return null; + return this.executor.schedule(() -> { + synchronized (lock) { + Preconditions.checkState(TimedReconnectStrategy.this.scheduled); + TimedReconnectStrategy.this.scheduled = false; } + + return null; }, this.lastSleep, TimeUnit.MILLISECONDS); }