|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.utils.ExponentialBackoff
public class 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 | |
|---|---|
static class |
ExponentialBackoff.Params
Parameters to configure a particular kind of exponential backoff. |
| Field Summary | |
|---|---|
static int |
DEFAULT_INITIAL_MILLIS
|
static int |
DEFAULT_MAXIMUM_MILLIS
|
static float |
DEFAULT_MULTIPLIER
|
| Constructor Summary | |
|---|---|
ExponentialBackoff(ExponentialBackoff.Params params)
|
|
| Method Summary | |
|---|---|
int |
compareTo(ExponentialBackoff other)
|
long |
getRetryTime()
Get the next time to retry, in milliseconds since the epoch |
String |
toString()
|
void |
trackFailure()
Track a failure - multiply the back off interval by the multiplier |
void |
trackSuccess()
Track a success - reset back off interval to the initial value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_INITIAL_MILLIS
public static final float DEFAULT_MULTIPLIER
public static final int DEFAULT_MAXIMUM_MILLIS
| Constructor Detail |
|---|
public ExponentialBackoff(ExponentialBackoff.Params params)
| Method Detail |
|---|
public void trackSuccess()
public void trackFailure()
public long getRetryTime()
public int compareTo(ExponentialBackoff other)
compareTo in interface Comparable<ExponentialBackoff>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||