Builder - the type of builder for retrying filterFilter - the type of retrying filter to buildMeta - the type of meta-data for retryFor(BiPredicate)public abstract class AbstractRetryingFilterBuilder<Builder extends AbstractRetryingFilterBuilder<Builder,Filter,Meta>,Filter,Meta>
extends java.lang.Object
RetryStrategies| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings<Meta>
A read-only settings for retryable filters.
|
| Constructor and Description |
|---|
AbstractRetryingFilterBuilder() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Filter |
build(AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings<Meta> readOnlySettings)
Builds a retrying
Filter for provided
ReadOnlyRetryableSettings<Meta>. |
Filter |
buildWithConstantBackoff(java.time.Duration delay)
Creates a new retrying
Filter which adds the passed constant Duration as a delay between retries. |
Filter |
buildWithConstantBackoff(java.time.Duration delay,
Executor timerExecutor)
Creates a new retrying
Filter which adds the passed constant Duration as a delay between retries. |
Filter |
buildWithConstantBackoffAndJitter(java.time.Duration delay)
Creates a new retrying
Filter which adds a randomized delay between retries and uses the passed
Duration as a maximum delay possible. |
Filter |
buildWithConstantBackoffAndJitter(java.time.Duration delay,
Executor timerExecutor)
Creates a new retrying
Filter which adds a randomized delay between retries and uses the passed
Duration as a maximum delay possible. |
Filter |
buildWithExponentialBackoff(java.time.Duration initialDelay)
Creates a new retrying
Filter which adds a delay between retries. |
Filter |
buildWithExponentialBackoff(java.time.Duration initialDelay,
Executor timerExecutor)
Creates a new retrying
Filter which adds a delay between retries. |
Filter |
buildWithExponentialBackoffAndJitter(java.time.Duration initialDelay)
Creates a new retrying
Filter which adds a delay between retries. |
Filter |
buildWithExponentialBackoffAndJitter(java.time.Duration initialDelay,
Executor timerExecutor)
Creates a new retrying
Filter which adds a delay between retries. |
Filter |
buildWithImmediateRetries()
Creates a new retrying
Filter which retries without delay. |
java.util.function.BiPredicate<Meta,java.lang.Throwable> |
defaultRetryForPredicate()
Returns a default value for
retryFor(BiPredicate). |
Builder |
maxRetries(int maxRetries)
Set the maximum number of allowed retry operations before giving up.
|
Builder |
retryFor(java.util.function.BiPredicate<Meta,java.lang.Throwable> retryForPredicate)
Overrides the default criterion for determining which requests or errors should be retried.
|
public final Builder maxRetries(int maxRetries)
maxRetries - Maximum number of allowed retries before giving upthispublic final Builder retryFor(java.util.function.BiPredicate<Meta,java.lang.Throwable> retryForPredicate)
retryForPredicate - BiPredicate that checks whether a given combination of
meta-data and cause should be retriedthispublic final Filter buildWithImmediateRetries()
Filter which retries without delay.Filter which retries without delaypublic final Filter buildWithConstantBackoff(java.time.Duration delay)
Filter which adds the passed constant Duration as a delay between retries.delay - Constant Duration of delay between retriesFilter which adds a constant delay between retriespublic final Filter buildWithConstantBackoff(java.time.Duration delay, Executor timerExecutor)
Filter which adds the passed constant Duration as a delay between retries.delay - Constant Duration of delay between retriestimerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an
alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argumentFilter which adds a constant delay between retriespublic final Filter buildWithConstantBackoffAndJitter(java.time.Duration delay)
Filter which adds a randomized delay between retries and uses the passed
Duration as a maximum delay possible.delay - Maximum Duration of delay between retriesFilter which adds a randomized delay between retriespublic final Filter buildWithConstantBackoffAndJitter(java.time.Duration delay, Executor timerExecutor)
Filter which adds a randomized delay between retries and uses the passed
Duration as a maximum delay possible.delay - Maximum Duration of delay between retriestimerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an
alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argumentFilter which adds a randomized delay between retriespublic final Filter buildWithExponentialBackoff(java.time.Duration initialDelay)
Filter which adds a delay between retries. For first retry, the delay is
initialDelay which is increased exponentially for subsequent retries.
Returned Filter may not attempt to check for overflow if the retry count is high enough that an
exponential delay causes Long overflow.
initialDelay - Delay Duration for the first retry and increased exponentially with each retryFilter which adds an exponentially increasing delay between retriespublic final Filter buildWithExponentialBackoff(java.time.Duration initialDelay, Executor timerExecutor)
Filter which adds a delay between retries. For first retry, the delay is
initialDelay which is increased exponentially for subsequent retries.
Returned Filter may not attempt to check for overflow if the retry count is high enough that an
exponential delay causes Long overflow.
initialDelay - Delay Duration for the first retry and increased exponentially with each retrytimerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an
alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argumentFilter which adds an exponentially increasing delay between retriespublic final Filter buildWithExponentialBackoffAndJitter(java.time.Duration initialDelay)
Filter which adds a delay between retries. For first retry, the delay is
initialDelay which is increased exponentially for subsequent retries. This additionally adds a
"Full Jitter" for the backoff as described
here.
Returned Filter may not attempt to check for overflow if the retry count is high enough that an
exponential delay causes Long overflow.
initialDelay - Delay Duration for the first retry and increased exponentially with each retryFilter which adds an exponentially increasing delay between retries with jitterpublic final Filter buildWithExponentialBackoffAndJitter(java.time.Duration initialDelay, Executor timerExecutor)
Filter which adds a delay between retries. For first retry, the delay is
initialDelay which is increased exponentially for subsequent retries. This additionally adds a
"Full Jitter" for the backoff as described
here.
Returned Filter may not attempt to check for overflow if the retry count is high enough that an
exponential delay causes Long overflow.
initialDelay - Delay Duration for the first retry and increased exponentially with each retrytimerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an
alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argumentFilter which adds an exponentially increasing delay between retries with jitterprotected abstract Filter build(AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings<Meta> readOnlySettings)
Filter for provided
ReadOnlyRetryableSettings<Meta>.readOnlySettings - a read-only settings for retryable filtersFilterpublic java.util.function.BiPredicate<Meta,java.lang.Throwable> defaultRetryForPredicate()
retryFor(BiPredicate).retryFor(BiPredicate)