Class RetryOptions.Builder

  • Enclosing class:
    RetryOptions

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

      • setInitialInterval

        public RetryOptions.Builder setInitialInterval​(java.time.Duration initialInterval)
        Interval of the first retry. If coefficient is 1.0 then it is used for all retries. Required.
      • setBackoffCoefficient

        public RetryOptions.Builder setBackoffCoefficient​(double backoffCoefficient)
        Coefficient used to calculate the next retry interval. The next retry interval is previous interval multiplied by this coefficient. Must be 1 or larger. Default is 2.0.
      • setMaximumAttempts

        public RetryOptions.Builder setMaximumAttempts​(int maximumAttempts)
        When exceeded the amount of attempts, stop. Even if expiration time is not reached.
        Default is unlimited.
        Parameters:
        maximumAttempts - Maximum number of attempts. Default will be used if set to 0.
      • setMaximumInterval

        public RetryOptions.Builder setMaximumInterval​(java.time.Duration maximumInterval)
        Maximum interval between retries. Exponential backoff leads to interval increase. This value is the cap of the increase.
        Default is 100x of initial interval. Can't be less than setInitialInterval(Duration)
        Parameters:
        maximumInterval - the maximum interval value. Default will be used if set to null.
      • build

        public RetryOptions build()
        Build RetryOptions without performing validation as validation should be done after merging with MethodRetry.
      • validateBuildWithDefaults

        public RetryOptions validateBuildWithDefaults()
        Validates property values and builds RetryOptions with default values.