Interface RetryStrategy.Builder<B extends RetryStrategy.Builder<B,​T>,​T extends RetryStrategy>

    • Method Detail

      • retryOnException

        B retryOnException​(Predicate<Throwable> shouldRetry)
        Configure the strategy to retry when the provided predicate returns true, given a failure exception.
      • retryOnException

        default B retryOnException​(Class<? extends Throwable> throwable)
        Configure the strategy to retry when a failure exception class is equal to the provided class.
      • retryOnExceptionInstanceOf

        default B retryOnExceptionInstanceOf​(Class<? extends Throwable> throwable)
        Configure the strategy to retry when a failure exception class is an instance of the provided class (includes subtypes).
      • retryOnExceptionOrCause

        default B retryOnExceptionOrCause​(Class<? extends Throwable> throwable)
        Configure the strategy to retry when a failure exception or one of its cause classes is equal to the provided class.
      • retryOnExceptionOrCauseInstanceOf

        default B retryOnExceptionOrCauseInstanceOf​(Class<? extends Throwable> throwable)
        Configure the strategy to retry when a failure exception or one of its cause classes is an instance of the provided class (includes subtypes).
      • retryOnRootCause

        default B retryOnRootCause​(Class<? extends Throwable> throwable)
        Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is equal to the provided class.
      • retryOnRootCauseInstanceOf

        default B retryOnRootCauseInstanceOf​(Class<? extends Throwable> throwable)
        Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is an instance of to the provided class (includes subtypes).
      • maxAttempts

        B maxAttempts​(int maxAttempts)
        Configure the maximum number of attempts used by the retry strategy.

        The actual number of attempts made may be less, depending on the retry strategy implementation. For example, the standard and adaptive retry modes both employ short-circuiting which reduces the maximum attempts during outages.

        The default value for the standard and adaptive retry strategies is 3.

      • backoffStrategy

        B backoffStrategy​(BackoffStrategy backoffStrategy)
        Configure the backoff strategy used by the retry strategy.

        By default, this uses jittered exponential backoff.

      • throttlingBackoffStrategy

        B throttlingBackoffStrategy​(BackoffStrategy throttlingBackoffStrategy)
        Configure the backoff strategy used for throttling exceptions by this strategy.

        By default, this uses jittered exponential backoff.

      • useClientDefaults

        default B useClientDefaults​(boolean useClientDefaults)
        Configure whether the default predicates should be used, or not. When set to false, only user-provided retry predicates will be considered to determine what should be retried or not. Setting this to false and providing no predicate will result in an empty retry strategy.