Interface RetryInterceptor.BackoffStrategy
- Enclosing class:
RetryInterceptor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A strategy for backing off (delaying) before a retry.
-
Method Summary
Modifier and TypeMethodDescriptionbackoff(RetryInterceptor.Context<?> context) Returns theDurationto wait for before retrying the request for the given retry number.exponential(Duration base, Duration cap) Returns aBackoffStrategythat applies an exponentially (base 2) increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.Returns aBackoffStrategythat applies a fixed delay every retry.Returns aBackoffStrategythat applies a linearly increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.none()Returns aBackoffStrategythat applies no delays.retryAfterOr(RetryInterceptor.BackoffStrategy fallback) Returns aBackoffStrategythat gets the delay from the value of response'sRetry-Afterheader, or defers to the givenBackoffStrategyif no such header exists.default RetryInterceptor.BackoffStrategydefault RetryInterceptor.BackoffStrategywithJitter(double factor) Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy, where the degree of "fullness" is specified by the given factor.
-
Method Details
-
backoff
Returns theDurationto wait for before retrying the request for the given retry number. -
withJitter
Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy. Calling this method is equivalent towithJitter(1.0). -
withJitter
Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy, where the degree of "fullness" is specified by the given factor. -
none
Returns aBackoffStrategythat applies no delays. -
fixed
Returns aBackoffStrategythat applies a fixed delay every retry. -
linear
Returns aBackoffStrategythat applies a linearly increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay. -
exponential
Returns aBackoffStrategythat applies an exponentially (base 2) increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay. -
retryAfterOr
Returns aBackoffStrategythat gets the delay from the value of response'sRetry-Afterheader, or defers to the givenBackoffStrategyif no such header exists.
-