Class ExponentialBackOff

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class ExponentialBackOff
    extends Object
    implements Closeable
    Retry with exponential backoff. Calls checkCallback until it does not throw an Exception. Retries are first done with startDelay, then doubled until maxDelay is reached.
    • Constructor Detail

      • ExponentialBackOff

        public ExponentialBackOff​(long startDelay,
                                  long maxDelay,
                                  boolean randomDelay,
                                  Runnable checkCallback)
        Parameters:
        startDelay - the start delay in milliseconds
        maxDelay - the max delay in milliseconds
        randomDelay - true to randomise the delay between 0 and the current max delay ; false to use the current max delay.
        checkCallback - the code to invoke when the current delay has elapsed
    • Method Detail

      • startChecks

        public void startChecks()