Package com.google.api.client.util
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 long
Indicates that no more retries should be made for use innextBackOffMillis()
.static final BackOff
Fixed back-off policy that always returns#STOP
fornextBackOffMillis()
, meaning that the operation should not be retried.static final BackOff
Fixed 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#STOP
fornextBackOffMillis()
, meaning that the operation should not be retried.
-
-
Method Details
-
reset
Reset to initial state.- Throws:
IOException
-
nextBackOffMillis
Gets the number of milliseconds to wait before retrying the operation orSTOP
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 }
- Throws:
IOException
-