Class TimedReconnectStrategy
- java.lang.Object
-
- org.opendaylight.netconf.nettyutil.TimedReconnectStrategy
-
- All Implemented Interfaces:
ReconnectStrategy
@Deprecated public final class TimedReconnectStrategy extends Object implements ReconnectStrategy
Deprecated.Swiss army knife equivalent for reconnect strategies. This class is thread-safe.This strategy continues to schedule reconnect attempts, each having to complete in a fixed time (connectTime).
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 (maxSleep).
The strategy can optionally give up based on two criteria:
A preset number of connection retries (maxAttempts) has been reached, or
A preset absolute deadline is reached (deadline nanoseconds, as reported by System.nanoTime(). In this specific case, both connectTime and maxSleep will be controlled such that the connection attempt is resolved as closely to the deadline as possible.
Both these caps can be combined, with the strategy giving up as soon as the first one is reached.
-
-
Constructor Summary
Constructors Constructor Description TimedReconnectStrategy(io.netty.util.concurrent.EventExecutor executor, int connectTime, long minSleep, double sleepFactor, Long maxSleep, Long maxAttempts, Long deadline)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetConnectTimeout()Deprecated.Query the strategy for the connect timeout.voidreconnectSuccessful()Deprecated.Reset the strategy state.io.netty.util.concurrent.Future<Void>scheduleReconnect(Throwable cause)Deprecated.Schedule a connection attempt.
-
-
-
Method Detail
-
scheduleReconnect
public io.netty.util.concurrent.Future<Void> scheduleReconnect(Throwable cause)
Deprecated.Description copied from interface:ReconnectStrategySchedule a connection attempt. The precise time when the connection should be attempted is signaled by successful completion of returned future.- Specified by:
scheduleReconnectin interfaceReconnectStrategy- Parameters:
cause- Cause of previous failure- Returns:
- a future tracking the schedule, may not be null
-
reconnectSuccessful
public void reconnectSuccessful()
Deprecated.Description copied from interface:ReconnectStrategyReset the strategy state. Users call this method once the reconnection process succeeds.- Specified by:
reconnectSuccessfulin interfaceReconnectStrategy
-
getConnectTimeout
public int getConnectTimeout() throws TimeoutExceptionDeprecated.Description copied from interface:ReconnectStrategyQuery the strategy for the connect timeout.- Specified by:
getConnectTimeoutin interfaceReconnectStrategy- Returns:
- connect try timeout in milliseconds, or 0 for infinite (or system-default) timeout
- Throws:
TimeoutException
-
-