Class BackoffStrategy.Builder

  • Enclosing class:
    BackoffStrategy

    public static final class BackoffStrategy.Builder
    extends java.lang.Object
    • Method Detail

      • initialInterval

        public BackoffStrategy.Builder initialInterval​(long duration,
                                                       java.util.concurrent.TimeUnit unit)
        Sets the initial interval
        Parameters:
        duration - The initial interval.
        unit - The time unit associated with duration.
        Returns:
        The builder instance.
      • maxInterval

        public BackoffStrategy.Builder maxInterval​(long duration,
                                                   java.util.concurrent.TimeUnit unit)
        Sets the maximum interval
        Parameters:
        duration - The maximum interval.
        unit - The time unit associated with duration.
        Returns:
        The builder instance.
      • maxElapsedTime

        public BackoffStrategy.Builder maxElapsedTime​(long duration,
                                                      java.util.concurrent.TimeUnit unit)
        Sets the maximum elapsed time
        Parameters:
        duration - The maximum elapsed time.
        unit - The time unit associated with duration.
        Returns:
        The builder instance.
      • baseFactor

        public BackoffStrategy.Builder baseFactor​(double baseFactor)
        Sets the backoff base factor.
        Parameters:
        baseFactor - The base factor to use.
        Returns:
        The builder instance.
      • exponent

        @Deprecated
        public BackoffStrategy.Builder exponent​(double baseFactor)
        Deprecated.
        use baseFactor(double) instead.
        Sets the backoff base factor.
        Parameters:
        baseFactor - The base factor to use.
        Returns:
        The builder instance.
      • jitterFactor

        public BackoffStrategy.Builder jitterFactor​(double jitterFactor)
        Sets the jitter factor used to randomize the backoff interval.
        Parameters:
        jitterFactor - The jitter factor to use (default is 0.5f).
        Returns:
        The builder instance.
      • retryConnectError

        public BackoffStrategy.Builder retryConnectError​(boolean retry)
        Specifies whether connection errors should be retried.
        Parameters:
        retry - Whether to retry on connection error.
        Returns:
        The builder instance.
      • throwConnectError

        public BackoffStrategy.Builder throwConnectError()
        Do not retry on connection error.
        Returns:
        The builder instance.
      • retryReadTimeoutError

        public BackoffStrategy.Builder retryReadTimeoutError​(boolean retry)
        Specifies whether Read Timeout errors should be retried.
        Parameters:
        retry - Whether to retry on Read Timeout error.
        Returns:
        The builder instance.
      • throwReadTimeoutError

        public BackoffStrategy.Builder throwReadTimeoutError()
        Do not retry on Read Timeout error.
        Returns:
        The builder instance.