public class ExponentialBackoff
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INITIAL_INTERVAL_MILLIS
The default initial interval value in milliseconds (10 seconds).
|
static int |
DEFAULT_MAX_INTERVAL_MILLIS
The default maximum back off time in milliseconds (10 minutes).
|
static double |
DEFAULT_MULTIPLIER
The default multiplier value (2.0 which is 100% increase per back off).
|
| Constructor and Description |
|---|
ExponentialBackoff() |
| Modifier and Type | Method and Description |
|---|---|
int |
getCurrentIntervalMillis()
Returns the current retry interval in milliseconds.
|
long |
getElapsedTimeMillis()
Returns the elapsed time in milliseconds since an
ExponentialBackoff instance is
created and is reset when reset() is called. |
int |
getInitialIntervalMillis()
Returns the initial retry interval in milliseconds.
|
int |
getMaxIntervalMillis()
Returns the maximum value of the back off period in milliseconds.
|
double |
getMultiplier()
Returns the value to multiply the current interval with for each retry attempt.
|
long |
nextBackOffMillis()
Get the next back off interval
|
void |
reset()
Sets the interval back to the initial retry interval and restarts the timer.
|
public static final int DEFAULT_INITIAL_INTERVAL_MILLIS
public static final double DEFAULT_MULTIPLIER
public static final int DEFAULT_MAX_INTERVAL_MILLIS
public final void reset()
public long nextBackOffMillis()
public final int getInitialIntervalMillis()
public final int getCurrentIntervalMillis()
public final double getMultiplier()
public final int getMaxIntervalMillis()
public final long getElapsedTimeMillis()
ExponentialBackoff instance is
created and is reset when reset() is called.
The elapsed time is computed using System.nanoTime().