Class Backoff.ExponentialBackoff

  • All Implemented Interfaces:
    Backoff
    Enclosing interface:
    Backoff

    public static class Backoff.ExponentialBackoff
    extends java.lang.Object
    implements Backoff
    • Constructor Summary

      Constructors 
      Constructor Description
      ExponentialBackoff​(int maxAttempts, long baseSleepTimeMillis, long maxSleepMillis, java.util.function.DoubleSupplier randomSource)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long computeWaitTime​(int retryCount)  
      int maxAttempts()  
      java.util.concurrent.TimeUnit unit()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExponentialBackoff

        public ExponentialBackoff​(int maxAttempts,
                                  long baseSleepTimeMillis,
                                  long maxSleepMillis,
                                  java.util.function.DoubleSupplier randomSource)
    • Method Detail

      • maxAttempts

        public int maxAttempts()
        Specified by:
        maxAttempts in interface Backoff
        Returns:
        max attempts allowed, == 0 implies no retries are allowed
      • computeWaitTime

        public long computeWaitTime​(int retryCount)
        Specified by:
        computeWaitTime in interface Backoff
      • unit

        public java.util.concurrent.TimeUnit unit()
        Specified by:
        unit in interface Backoff