Class ExponentialBackoff

java.lang.Object
org.bitcoinj.utils.ExponentialBackoff
All Implemented Interfaces:
Comparable<ExponentialBackoff>

public class ExponentialBackoff extends Object implements 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 Details

  • Constructor Details

  • Method Details

    • 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
    • getRetryTime

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

      public int compareTo(ExponentialBackoff other)
      Specified by:
      compareTo in interface Comparable<ExponentialBackoff>
    • toString

      public String toString()
      Overrides:
      toString in class Object