Class RecoveryDelayHandler.ExponentialBackoffDelayHandler

    • Constructor Detail

      • ExponentialBackoffDelayHandler

        public ExponentialBackoffDelayHandler()
        Default Constructor. Uses the following sequence: 2000, 3000, 5000, 8000, 13000, 21000, 34000
      • ExponentialBackoffDelayHandler

        public ExponentialBackoffDelayHandler​(List<Long> sequence)
        Constructor for passing your own backoff sequence
        sequence - List of recovery delay values in milliseconds.
        IllegalArgumentException - if the sequence is null or empty
    • Method Detail

      • getDelay

        public long getDelay​(int recoveryAttempts)
        Description copied from interface: RecoveryDelayHandler
        Get the time to sleep (in milliseconds) before attempting to reconnect and recover again. This method will be called with recoveryAttempts=0 before the first recovery attempt and then again after each failed recovery.
        Specified by:
        getDelay in interface RecoveryDelayHandler
        recoveryAttempts - The number of recovery attempts so far.
        the delay in milliseconds