Class ExponentialBackoffStrategy.Builder

  • Enclosing class:
    ExponentialBackoffStrategy

    public static class ExponentialBackoffStrategy.Builder
    extends java.lang.Object
    Builder class for the ExponentialBackoffStrategy. Allows fluent configuration of the backoff strategy parameters.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • maxAttempts

        public ExponentialBackoffStrategy.Builder maxAttempts​(int maxAttempts)
        Sets the maximum number of retry attempts.
        Parameters:
        maxAttempts - The maximum number of retry attempts.
        Returns:
        The current Builder instance.
      • backoffFactor

        public ExponentialBackoffStrategy.Builder backoffFactor​(float backoffFactor)
        Sets the backoff factor.
        Parameters:
        backoffFactor - The factor by which the backoff delay increases.
        Returns:
        The current Builder instance.
      • initialIntervalMillis

        public ExponentialBackoffStrategy.Builder initialIntervalMillis​(int initialIntervalMillis)
        Sets the initial interval (in milliseconds) for the first retry attempt.
        Parameters:
        initialIntervalMillis - The initial interval in milliseconds.
        Returns:
        The current Builder instance.
      • maxBackoffMillis

        public ExponentialBackoffStrategy.Builder maxBackoffMillis​(int maxBackoffMillis)
        Sets the maximum backoff (in milliseconds) between retries.
        Parameters:
        maxBackoffMillis - The maximum backoff in milliseconds.
        Returns:
        The current Builder instance.
      • jitterFactor

        public ExponentialBackoffStrategy.Builder jitterFactor​(float jitterFactor)
        Sets the jitter factor (between 0 and 1) to control how much to jitter the backoff delay.
        Parameters:
        jitterFactor - The jitter factor.
        Returns:
        The current Builder instance.
      • build

        public ExponentialBackoffStrategy build()
        Builds and returns a new ExponentialBackoffStrategy instance.
        Returns:
        A new ExponentialBackoffStrategy.