public interface BackoffPolicy
Modifier and Type | Field and Description |
---|---|
static BackoffPolicy |
DEFAULT
Default backoff policy with a factor of 2, starting at 500ms and getting
capped at 64000ms.
|
static long |
STOP
Value indicating that no more retries should be made,
getNextBackoffMs() . |
Modifier and Type | Method and Description |
---|---|
long |
getNextBackoffMs()
Gets the number of milliseconds to wait before retrying an HTTP request.
|
void |
reset()
Resets the policy to begin from its initial state.
|
static final BackoffPolicy DEFAULT
static final long STOP
getNextBackoffMs()
.long getNextBackoffMs()
STOP
is returned, no retries should be made.
This method should be used as follows:
long backoffTime = backoffPolicy.getNextBackoffMs(); if (backoffTime = BackoffPolicy.STOP) { // Stop retrying. } else { // Retry after backoffTime. }
STOP
if no more retries should be madevoid reset()