Interface Backoff
- All Superinterfaces:
Function<IterationContext<?>,
BackoffDelay>
Backoff function
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Backoff
exponential
(Duration firstBackoff, Duration maxBackoff, int factor, boolean basedOnPreviousValue) Backoff function with exponential backoff delay.static Backoff
Backoff function with fixed backoff delaystatic Backoff
zero()
Backoff function with no backoff delay
-
Field Details
-
ZERO_BACKOFF
-
-
Method Details
-
zero
Backoff function with no backoff delay- Returns:
- Backoff function for zero backoff delay
-
fixed
Backoff function with fixed backoff delay- Parameters:
backoffInterval
- backoff interval- Returns:
- Backoff function with fixed backoff delay
-
exponential
static Backoff exponential(Duration firstBackoff, @Nullable Duration maxBackoff, int factor, boolean basedOnPreviousValue) Backoff function with exponential backoff delay. Retries are performed after a backoff interval offirstBackoff * (factor ** n)
where n is the iteration. IfmaxBackoff
is not null, the maximum backoff applied will be limited tomaxBackoff
.If
basedOnPreviousValue
is true, backoff will be calculated usingprevBackoff * factor
. When backoffs are combined withJitter
, this value will be different from the actual exponential value for the iteration.- Parameters:
firstBackoff
- First backoff durationmaxBackoff
- Maximum backoff duration, capped toLong.MAX_VALUE
millisecondsfactor
- The multiplicand for calculating backoffbasedOnPreviousValue
- If true, calculation is based on previous value which may be a backoff with jitter applied- Returns:
- Backoff function with exponential delay
-