Interface BackOff
- All Known Implementing Classes:
ExponentialBackOff, MockBackOff
public interface BackOff
Back-off policy when retrying an operation.
- Since:
- 1.15
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longIndicates that no more retries should be made for use innextBackOffMillis().static final BackOffFixed back-off policy that always returns#STOPfornextBackOffMillis(), meaning that the operation should not be retried.static final BackOffFixed back-off policy whose back-off time is always zero, meaning that the operation is retried immediately without waiting. -
Method Summary
-
Field Details
-
STOP
static final long STOPIndicates that no more retries should be made for use innextBackOffMillis().- See Also:
-
ZERO_BACKOFF
Fixed back-off policy whose back-off time is always zero, meaning that the operation is retried immediately without waiting. -
STOP_BACKOFF
Fixed back-off policy that always returns#STOPfornextBackOffMillis(), meaning that the operation should not be retried.
-
-
Method Details
-
reset
-
nextBackOffMillis
Gets the number of milliseconds to wait before retrying the operation orSTOPto 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 }- Throws:
IOException
-