Class ExponentialBackoff

  • All Implemented Interfaces:

    public class ExponentialBackoff
    extends java.lang.Object
    implements java.lang.Comparable<ExponentialBackoff>

    Tracks successes and failures and calculates a time to retry the operation.

    The retries are exponentially backed off, up to a maximum interval. On success the back off interval is reset.

    • Field Detail


        public static final java.time.Duration DEFAULT_INITIAL_INTERVAL

        public static final java.time.Duration DEFAULT_MAXIMUM_INTERVAL
    • Method Detail

      • trackSuccess

        public final void trackSuccess()
        Track a success - reset back off interval to the initial value
      • trackFailure

        public void trackFailure()
        Track a failure - multiply the back off interval by the multiplier
      • retryTime

        public java.time.Instant retryTime()
        Get the next time to retry
      • getRetryTime

        public long getRetryTime()
        Get the next time to retry, in milliseconds since the epoch
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object