Make pauseBeforeReconnect overridable
@@ -120,12 +120,16 @@ public interface ConnectionStrategy extends Marshallable {
return sc;
Thread.yield();
// If nothing is listening, socketChannel returns pretty much immediately so we support a pause here
+ pauseBeforeReconnect(startMs);
+ }
+ }
+
+ default void pauseBeforeReconnect(long startMs) {
long pauseMillis = (startMs + pauseMillisBeforeReconnect()) - System.currentTimeMillis();
if (Jvm.isDebugEnabled(this.getClass()))
Jvm.debug().on(this.getClass(), "Waiting for reconnect "+pauseMillis+" ms");
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(pauseMillis));
}
- }
/**
* allows control of a backoff strategy
