Class RetryPolicy.Builder

java.lang.Object
express.mvp.myra.transport.error.RetryPolicy.Builder
Enclosing class:
RetryPolicy

public static final class RetryPolicy.Builder extends Object
Builder for RetryPolicy.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • maxAttempts

      public RetryPolicy.Builder maxAttempts(int maxAttempts)
      Sets the maximum number of attempts.
      Parameters:
      maxAttempts - max attempts (must be >= 1)
      Returns:
      this builder
    • initialDelay

      public RetryPolicy.Builder initialDelay(Duration delay)
      Sets the initial delay before first retry.
      Parameters:
      delay - initial delay
      Returns:
      this builder
    • maxDelay

      public RetryPolicy.Builder maxDelay(Duration maxDelay)
      Sets the maximum delay cap.
      Parameters:
      maxDelay - maximum delay
      Returns:
      this builder
    • backoffMultiplier

      public RetryPolicy.Builder backoffMultiplier(double multiplier)
      Sets the backoff multiplier.
      Parameters:
      multiplier - multiplier (1.0 = fixed delay, 2.0 = double each time)
      Returns:
      this builder
    • jitterFactor

      public RetryPolicy.Builder jitterFactor(double jitter)
      Sets the jitter factor.
      Parameters:
      jitter - jitter factor (0.0-1.0)
      Returns:
      this builder
    • maxTotalDuration

      public RetryPolicy.Builder maxTotalDuration(Duration duration)
      Sets maximum total duration for all retry attempts.
      Parameters:
      duration - maximum duration (0 = no limit)
      Returns:
      this builder
    • retryTransient

      public RetryPolicy.Builder retryTransient(boolean retry)
      Sets whether to retry transient errors.
      Parameters:
      retry - true to retry
      Returns:
      this builder
    • retryNetwork

      public RetryPolicy.Builder retryNetwork(boolean retry)
      Sets whether to retry network errors.
      Parameters:
      retry - true to retry
      Returns:
      this builder
    • retryResource

      public RetryPolicy.Builder retryResource(boolean retry)
      Sets whether to retry resource errors.
      Parameters:
      retry - true to retry
      Returns:
      this builder
    • retryUnknown

      public RetryPolicy.Builder retryUnknown(boolean retry)
      Sets whether to retry unknown errors.
      Parameters:
      retry - true to retry
      Returns:
      this builder
    • build

      public RetryPolicy build()
      Builds the retry policy.
      Returns:
      new policy