Class AbstractRetryingFilterBuilder<Builder extends AbstractRetryingFilterBuilder<Builder,​Filter,​Meta>,​Filter,​Meta>

  • Type Parameters:
    Builder - the type of builder for retrying filter
    Filter - the type of retrying filter to build
    Meta - the type of meta-data for retryFor(BiPredicate)
    Direct Known Subclasses:
    RetryingHttpRequesterFilter.Builder

    public abstract class AbstractRetryingFilterBuilder<Builder extends AbstractRetryingFilterBuilder<Builder,​Filter,​Meta>,​Filter,​Meta>
    extends java.lang.Object
    An abstract builder for retrying filters.
    See Also:
    RetryStrategies
    • Constructor Detail

      • AbstractRetryingFilterBuilder

        public AbstractRetryingFilterBuilder()
    • Method Detail

      • maxRetries

        public final Builder maxRetries​(int maxRetries)
        Set the maximum number of allowed retry operations before giving up.
        Parameters:
        maxRetries - Maximum number of allowed retries before giving up
        Returns:
        this
      • retryFor

        public final Builder retryFor​(java.util.function.BiPredicate<Meta,​java.lang.Throwable> retryForPredicate)
        Overrides the default criterion for determining which requests or errors should be retried.
        Parameters:
        retryForPredicate - BiPredicate that checks whether a given combination of meta-data and cause should be retried
        Returns:
        this
      • buildWithConstantBackoff

        public final Filter buildWithConstantBackoff​(java.time.Duration delay)
        Creates a new retrying AbstractRetryingFilterBuilder which adds the passed constant Duration as a delay between retries.
        Parameters:
        delay - Constant Duration of delay between retries
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds a constant delay between retries
      • buildWithConstantBackoffFullJitter

        public final Filter buildWithConstantBackoffFullJitter​(java.time.Duration delay)
        Creates a new retrying AbstractRetryingFilterBuilder which adds a randomized delay between retries and uses the passed Duration as a maximum delay possible. This additionally adds a "Full Jitter" for the backoff as described here.
        Parameters:
        delay - Maximum Duration of delay between retries
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds a randomized delay between retries
      • buildWithConstantBackoffDeltaJitter

        public final Filter buildWithConstantBackoffDeltaJitter​(java.time.Duration delay,
                                                                java.time.Duration jitter)
        Creates a new retrying AbstractRetryingFilterBuilder which adds a randomized delay between retries and uses the passed Duration as a maximum delay possible.
        Parameters:
        delay - Maximum Duration of delay between retries
        jitter - The jitter which is used as and offset to initialDelay on each retry
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds a randomized delay between retries
      • buildWithExponentialBackoffFullJitter

        public final Filter buildWithExponentialBackoffFullJitter​(java.time.Duration initialDelay,
                                                                  java.time.Duration maxDelay)
        Creates a new retrying AbstractRetryingFilterBuilder 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.
        Parameters:
        initialDelay - Delay Duration for the first retry and increased exponentially with each retry
        maxDelay - The maximum amount of delay that will be introduced.
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds an exponentially increasing delay between retries with jitter
      • buildWithExponentialBackoffFullJitter

        public final Filter buildWithExponentialBackoffFullJitter​(java.time.Duration initialDelay,
                                                                  java.time.Duration maxDelay,
                                                                  Executor timerExecutor)
        Creates a new retrying AbstractRetryingFilterBuilder 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.
        Parameters:
        initialDelay - Delay Duration for the first retry and increased exponentially with each retry
        maxDelay - The maximum amount of delay that will be introduced.
        timerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argument
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds an exponentially increasing delay between retries with jitter
      • buildWithExponentialBackoffDeltaJitter

        public final Filter buildWithExponentialBackoffDeltaJitter​(java.time.Duration initialDelay,
                                                                   java.time.Duration jitter,
                                                                   java.time.Duration maxDelay)
        Creates a new retrying AbstractRetryingFilterBuilder which adds a delay between retries. For first retry, the delay is initialDelay which is increased exponentially for subsequent retries.
        Parameters:
        initialDelay - Delay Duration for the first retry and increased exponentially with each retry
        jitter - The jitter which is used as and offset to initialDelay on each retry
        maxDelay - The maximum amount of delay that will be introduced.
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds an exponentially increasing delay between retries with jitter
      • buildWithExponentialBackoffDeltaJitter

        public final Filter buildWithExponentialBackoffDeltaJitter​(java.time.Duration initialDelay,
                                                                   java.time.Duration jitter,
                                                                   java.time.Duration maxDelay,
                                                                   Executor timerExecutor)
        Creates a new retrying AbstractRetryingFilterBuilder which adds a delay between retries. For first retry, the delay is initialDelay which is increased exponentially for subsequent retries.
        Parameters:
        initialDelay - Delay Duration for the first retry and increased exponentially with each retry
        jitter - The jitter which is used as and offset to initialDelay on each retry
        maxDelay - The maximum amount of delay that will be introduced.
        timerExecutor - Executor to be used to schedule timers for backoff. It takes precedence over an alternative timer Executor from AbstractRetryingFilterBuilder.ReadOnlyRetryableSettings.newStrategy(Executor) argument
        Returns:
        A new retrying AbstractRetryingFilterBuilder which adds an exponentially increasing delay between retries with jitter