public interface BackOff
Back-off policy when retrying an operation.
| Modifier and Type | Field and Description |
|---|---|
static long |
STOP
Indicates that no more retries should be made for use in
nextBackOffMillis(). |
static BackOff |
STOP_BACKOFF
Fixed back-off policy that always returns
#STOP for nextBackOffMillis(),
meaning that the operation should not be retried. |
static BackOff |
ZERO_BACKOFF
Fixed back-off policy whose back-off time is always zero, meaning that the operation is retried
immediately without waiting.
|
| Modifier and Type | Method and Description |
|---|---|
long |
nextBackOffMillis()
Gets the number of milliseconds to wait before retrying the operation or
STOP to
indicate that no retries should be made. |
void |
reset()
Reset to initial state.
|
static final long STOP
Indicates that no more retries should be made for use in nextBackOffMillis().
static final BackOff ZERO_BACKOFF
Fixed back-off policy whose back-off time is always zero, meaning that the operation is retried immediately without waiting.
static final BackOff STOP_BACKOFF
Fixed back-off policy that always returns #STOP for nextBackOffMillis(),
meaning that the operation should not be retried.
void reset()
Reset to initial state.
long nextBackOffMillis()
Gets the number of milliseconds to wait before retrying the operation or STOP to
indicate that no retries should be made.
<p> Example usage: </p>
<pre> long backOffMillis = backoff.nextBackOffMillis(); if (backOffMillis == Backoff.STOP) { // do not retry operation } else { // sleep for backOffMillis milliseconds and retry operation } </pre>