Package org.bitcoinj.utils
Class ExponentialBackoff
java.lang.Object
org.bitcoinj.utils.ExponentialBackoff
- All Implemented Interfaces:
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Parameters to configure a particular kind of exponential backoff. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ExponentialBackoff other) long
Deprecated.Get the next time to retrytoString()
void
Track a failure - multiply the back off interval by the multiplierfinal void
Track a success - reset back off interval to the initial value
-
Field Details
-
DEFAULT_INITIAL_INTERVAL
-
DEFAULT_MULTIPLIER
public static final float DEFAULT_MULTIPLIER- See Also:
-
DEFAULT_MAXIMUM_INTERVAL
-
-
Constructor Details
-
ExponentialBackoff
-
-
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 -
retryTime
Get the next time to retry -
getRetryTime
Deprecated.useretryTime()
Get the next time to retry, in milliseconds since the epoch -
compareTo
- Specified by:
compareTo
in interfaceComparable<ExponentialBackoff>
-
toString
-
retryTime()