Interface ReconnectStrategy

  • All Known Implementing Classes:
    NeverReconnectStrategy, ReconnectImmediatelyStrategy, TimedReconnectStrategy

    @Deprecated
    public interface ReconnectStrategy
    Deprecated.
    Interface exposed by a reconnection strategy provider. A reconnection strategy decides whether to attempt reconnection and when to do that.

    The proper way of using this API is such that when a connection attempt has failed, the user will call scheduleReconnect() to obtain a future, which tracks schedule of the next connect attempt. The user should add its own listener to be get notified when the future is done. Once the the notification fires, user should examine the future to see whether it is successful or not. If it is successful, the user should immediately initiate a connection attempt. If it is unsuccessful, the user must not attempt any more connection attempts and should abort the reconnection process.

    • Method Detail

      • getConnectTimeout

        int getConnectTimeout()
                       throws Exception
        Deprecated.
        Query the strategy for the connect timeout.
        Returns:
        connect try timeout in milliseconds, or 0 for infinite (or system-default) timeout
        Throws:
        Exception - if the connection should not be attempted
      • scheduleReconnect

        io.netty.util.concurrent.Future<Void> scheduleReconnect​(Throwable cause)
        Deprecated.
        Schedule a connection attempt. The precise time when the connection should be attempted is signaled by successful completion of returned future.
        Parameters:
        cause - Cause of previous failure
        Returns:
        a future tracking the schedule, may not be null
        Throws:
        IllegalStateException - when a connection attempt is currently scheduled.
      • reconnectSuccessful

        void reconnectSuccessful()
        Deprecated.
        Reset the strategy state. Users call this method once the reconnection process succeeds.