-
- 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.
@FunctionalInterface public static interface RetryInterceptor.BackoffStrategyA strategy for backing off (delaying) before a retry.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.time.Durationbackoff(RetryInterceptor.Context<?> context)Returns theDurationto wait for before retrying the request for the given retry number.static RetryInterceptor.BackoffStrategyexponential(java.time.Duration base, java.time.Duration cap)Returns aBackoffStrategythat applies an exponentially (base 2) increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.static RetryInterceptor.BackoffStrategyfixed(java.time.Duration delay)Returns aBackoffStrategythat applies a fixed delay every retry.static RetryInterceptor.BackoffStrategylinear(java.time.Duration base, java.time.Duration cap)Returns aBackoffStrategythat applies a linearly increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.static RetryInterceptor.BackoffStrategynone()Returns aBackoffStrategythat applies no delays.static RetryInterceptor.BackoffStrategyretryAfterOr(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.BackoffStrategywithJitter()default RetryInterceptor.BackoffStrategywithJitter(double factor)Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy, where the degree of "fullness" is specified by the given factor.
-
-
-
Method Detail
-
backoff
java.time.Duration backoff(RetryInterceptor.Context<?> context)
Returns theDurationto wait for before retrying the request for the given retry number.
-
withJitter
default RetryInterceptor.BackoffStrategy withJitter()
Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy. Calling this method is equivalent towithJitter(1.0).
-
withJitter
default RetryInterceptor.BackoffStrategy withJitter(double factor)
Returns aBackoffStrategythat applies full jitter to thisBackoffStrategy, where the degree of "fullness" is specified by the given factor.
-
none
static RetryInterceptor.BackoffStrategy none()
Returns aBackoffStrategythat applies no delays.
-
fixed
static RetryInterceptor.BackoffStrategy fixed(java.time.Duration delay)
Returns aBackoffStrategythat applies a fixed delay every retry.
-
linear
static RetryInterceptor.BackoffStrategy linear(java.time.Duration base, java.time.Duration cap)
Returns aBackoffStrategythat applies a linearly increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.
-
exponential
static RetryInterceptor.BackoffStrategy exponential(java.time.Duration base, java.time.Duration cap)
Returns aBackoffStrategythat applies an exponentially (base 2) increasing delay every retry, wherebasespecifies the first delay, andcapspecifies the maximum delay.
-
retryAfterOr
static RetryInterceptor.BackoffStrategy 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.
-
-