Class Backoff


  • public class Backoff
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Backoff​(long initial, java.util.concurrent.TimeUnit unitInitial, long max, java.util.concurrent.TimeUnit unitMax, long mandatoryStop, java.util.concurrent.TimeUnit unitMandatoryStop)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long next()  
      void reduceToHalf()  
      void reset()  
      static boolean shouldBackoff​(long initialTimestamp, java.util.concurrent.TimeUnit unitInitial, int failedAttempts)  
      static boolean shouldBackoff​(long initialTimestamp, java.util.concurrent.TimeUnit unitInitial, int failedAttempts, long defaultInterval, long maxBackoffInterval)  
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_INTERVAL_IN_NANOSECONDS

        public static final long DEFAULT_INTERVAL_IN_NANOSECONDS
      • MAX_BACKOFF_INTERVAL_NANOSECONDS

        public static final long MAX_BACKOFF_INTERVAL_NANOSECONDS
    • Constructor Detail

      • Backoff

        public Backoff​(long initial,
                       java.util.concurrent.TimeUnit unitInitial,
                       long max,
                       java.util.concurrent.TimeUnit unitMax,
                       long mandatoryStop,
                       java.util.concurrent.TimeUnit unitMandatoryStop)
    • Method Detail

      • next

        public long next()
      • reduceToHalf

        public void reduceToHalf()
      • reset

        public void reset()
      • shouldBackoff

        public static boolean shouldBackoff​(long initialTimestamp,
                                            java.util.concurrent.TimeUnit unitInitial,
                                            int failedAttempts,
                                            long defaultInterval,
                                            long maxBackoffInterval)
      • shouldBackoff

        public static boolean shouldBackoff​(long initialTimestamp,
                                            java.util.concurrent.TimeUnit unitInitial,
                                            int failedAttempts)