Package io.servicetalk.http.netty
Class RetryingHttpRequesterFilter.BackOffPolicy
java.lang.Object
io.servicetalk.http.netty.RetryingHttpRequesterFilter.BackOffPolicy
- Enclosing class:
- RetryingHttpRequesterFilter
Definition and presets of retry backoff policies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RetryingHttpRequesterFilter.BackOffPolicyDeprecated.This will be removed in a future release of ST. -
Method Summary
Modifier and TypeMethodDescriptionnewStrategy(Executor alternativeTimerExecutor) Builds a new retry strategyBiIntFunctionfor retrying withPublisher.retryWhen(BiIntFunction),Single.retryWhen(BiIntFunction), andCompletable.retryWhen(BiIntFunction)or in general with an alternative timerExecutor.ofConstantBackoffDeltaJitter(Duration delay, Duration jitter, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.ofConstantBackoffDeltaJitter(Duration delay, Duration jitter, Executor timerExecutor, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.ofConstantBackoffFullJitter(Duration delay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.ofConstantBackoffFullJitter(Duration delay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.ofExponentialBackoffDeltaJitter(Duration initialDelay, Duration jitter, Duration maxDelay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries.ofExponentialBackoffDeltaJitter(Duration initialDelay, Duration jitter, Duration maxDelay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries.ofExponentialBackoffFullJitter(Duration initialDelay, Duration maxDelay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries.ofExponentialBackoffFullJitter(Duration initialDelay, Duration maxDelay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries.Deprecated.UseofImmediateBounded().ofImmediate(int maxRetries) Creates a newRetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to provided max retries.Creates a newRetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to 3 max retries.SpecialRetryingHttpRequesterFilter.BackOffPolicythat signals that no retries will be attempted.toString()
-
Field Details
-
NO_RETRIES
Deprecated.This will be removed in a future release of ST. Alternative offering hereofNoRetries().SpecialRetryingHttpRequesterFilter.BackOffPolicyto signal no retries.
-
-
Method Details
-
toString
-
ofImmediate
Deprecated.UseofImmediateBounded().Creates a newRetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to 3 max retries.- Returns:
- a new
RetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to 3 max retries.
-
ofImmediateBounded
Creates a newRetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to 3 max retries.- Returns:
- a new
RetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to 3 max retries. - See Also:
-
ofImmediate
Creates a newRetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to provided max retries.- Parameters:
maxRetries- the number of retry attempts for thisRetryingHttpRequesterFilter.BackOffPolicy.- Returns:
- a new
RetryingHttpRequesterFilter.BackOffPolicythat retries failures instantly up-to provided max retries.
-
ofNoRetries
SpecialRetryingHttpRequesterFilter.BackOffPolicythat signals that no retries will be attempted.- Returns:
- a special
RetryingHttpRequesterFilter.BackOffPolicythat signals that no retries will be attempted.
-
ofConstantBackoffFullJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofConstantBackoffFullJitter(Duration delay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible. This additionally adds a "Full Jitter" for the backoff as described here.- Parameters:
delay- MaximumDurationof delay between retriesmaxRetries- The maximum retries before it gives up.- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries
-
ofConstantBackoffFullJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofConstantBackoffFullJitter(Duration delay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible. This additionally adds a "Full Jitter" for the backoff as described here.- Parameters:
delay- MaximumDurationof delay between retriesmaxRetries- The maximum retries before it gives up.timerExecutor-Executorto be used to schedule timers for backoff. It takes precedence over an alternative timerExecutorfromnewStrategy(Executor)argument- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries
-
ofConstantBackoffDeltaJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofConstantBackoffDeltaJitter(Duration delay, Duration jitter, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.- Parameters:
delay- MaximumDurationof delay between retriesjitter- The jitter which is used as and offset toinitialDelayon each retrymaxRetries- The maximum retries before it gives up.- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries
-
ofConstantBackoffDeltaJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofConstantBackoffDeltaJitter(Duration delay, Duration jitter, Executor timerExecutor, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries and uses the passedDurationas a maximum delay possible.- Parameters:
delay- MaximumDurationof delay between retriesjitter- The jitter which is used as and offset todelayon each retrytimerExecutor-Executorto be used to schedule timers for backoff.maxRetries- The maximum retries before it gives up. It takes precedence over an alternative timerExecutorfromnewStrategy(Executor)argument- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds a randomized delay between retries
-
ofExponentialBackoffFullJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofExponentialBackoffFullJitter(Duration initialDelay, Duration maxDelay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries. For first retry, the delay isinitialDelaywhich is increased exponentially for subsequent retries. This additionally adds a "Full Jitter" for the backoff as described here.- Parameters:
initialDelay- DelayDurationfor the first retry and increased exponentially with each retrymaxDelay- The maximum amount of delay that will be introduced.maxRetries- The maximum retries before it gives up.- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds an exponentially increasing delay between retries with jitter
-
ofExponentialBackoffFullJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofExponentialBackoffFullJitter(Duration initialDelay, Duration maxDelay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries. For first retry, the delay isinitialDelaywhich is increased exponentially for subsequent retries. This additionally adds a "Full Jitter" for the backoff as described here.- Parameters:
initialDelay- DelayDurationfor the first retry and increased exponentially with each retrymaxDelay- The maximum amount of delay that will be introduced.maxRetries- The maximum retries before it gives up.timerExecutor-Executorto be used to schedule timers for backoff. It takes precedence over an alternative timerExecutorfromnewStrategy(Executor)argument- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds an exponentially increasing delay between retries with jitter
-
ofExponentialBackoffDeltaJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofExponentialBackoffDeltaJitter(Duration initialDelay, Duration jitter, Duration maxDelay, int maxRetries) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries. For first retry, the delay isinitialDelaywhich is increased exponentially for subsequent retries.- Parameters:
initialDelay- DelayDurationfor the first retry and increased exponentially with each retryjitter- The jitter which is used as and offset toinitialDelayon each retrymaxDelay- The maximum amount of delay that will be introduced.maxRetries- The maximum retries before it gives up.- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds an exponentially increasing delay between retries with jitter
-
ofExponentialBackoffDeltaJitter
public static RetryingHttpRequesterFilter.BackOffPolicy ofExponentialBackoffDeltaJitter(Duration initialDelay, Duration jitter, Duration maxDelay, int maxRetries, Executor timerExecutor) Creates a new retryingRetryingHttpRequesterFilter.BackOffPolicywhich adds a delay between retries. For first retry, the delay isinitialDelaywhich is increased exponentially for subsequent retries.- Parameters:
initialDelay- DelayDurationfor the first retry and increased exponentially with each retryjitter- The jitter which is used as and offset toinitialDelayon each retrymaxDelay- The maximum amount of delay that will be introduced.maxRetries- The maximum retries before it gives up.timerExecutor-Executorto be used to schedule timers for backoff. It takes precedence over an alternative timerExecutorfromnewStrategy(Executor)argument- Returns:
- A new retrying
RetryingHttpRequesterFilter.BackOffPolicywhich adds an exponentially increasing delay between retries with jitter
-
newStrategy
Builds a new retry strategyBiIntFunctionfor retrying withPublisher.retryWhen(BiIntFunction),Single.retryWhen(BiIntFunction), andCompletable.retryWhen(BiIntFunction)or in general with an alternative timerExecutor.- Parameters:
alternativeTimerExecutor-Executorto be used to schedule timers for backoff if no executor was provided at the build time- Returns:
- a new retry strategy
BiIntFunction
-