public interface BackOffBack-off policy when retrying an operation.
Static Fields
STOP
public static final long STOPIndicates that no more retries should be made for use in #nextBackOffMillis().
| Field Value | |
|---|---|
| Type | Description |
long |
|
STOP_BACKOFF
public static final BackOff STOP_BACKOFFFixed back-off policy that always returns #STOP for #nextBackOffMillis(),
meaning that the operation should not be retried.
| Field Value | |
|---|---|
| Type | Description |
BackOff |
|
ZERO_BACKOFF
public static final BackOff ZERO_BACKOFFFixed back-off policy whose back-off time is always zero, meaning that the operation is retried immediately without waiting.
| Field Value | |
|---|---|
| Type | Description |
BackOff |
|
Methods
nextBackOffMillis()
public abstract long nextBackOffMillis()Gets the number of milliseconds to wait before retrying the operation or #STOP to indicate that no retries should be made.
Example usage:
long backOffMillis = backoff.nextBackOffMillis(); if (backOffMillis == Backoff.STOP) { // do not retry operation } else { // sleep for backOffMillis milliseconds and retry operation }
| Returns | |
|---|---|
| Type | Description |
long |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
reset()
public abstract void reset()Reset to initial state.
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|