Package com.uber.cadence.common
Class RetryOptions.Builder
- java.lang.Object
-
- com.uber.cadence.common.RetryOptions.Builder
-
- Enclosing class:
- RetryOptions
public static final class RetryOptions.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(RetryOptions o)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RetryOptions
build()
Build RetryOptions without performing validation as validation should be done after merging withMethodRetry
.RetryOptions.Builder
setBackoffCoefficient(double backoffCoefficient)
Coefficient used to calculate the next retry interval.RetryOptions.Builder
setDoNotRetry(java.lang.Class<? extends java.lang.Throwable>... doNotRetry)
List of exceptions to skip retry.RetryOptions.Builder
setExpiration(java.time.Duration expiration)
Maximum time to retry.RetryOptions.Builder
setInitialInterval(java.time.Duration initialInterval)
Interval of the first retry.RetryOptions.Builder
setMaximumAttempts(int maximumAttempts)
Maximum number of attempts.RetryOptions.Builder
setMaximumInterval(java.time.Duration maximumInterval)
Maximum interval between retries.RetryOptions
validateBuildWithDefaults()
Validates property values and builds RetryOptions with default values.
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(RetryOptions o)
-
-
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.
-
setExpiration
public RetryOptions.Builder setExpiration(java.time.Duration expiration)
Maximum time to retry. Required. When exceeded the retries stop even if maximum retries is not reached yet.
-
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)
Maximum number of attempts. When exceeded the retries stop even if not expired yet. Must be 1 or bigger. Default is unlimited.
-
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.
-
setDoNotRetry
@SafeVarargs public final RetryOptions.Builder setDoNotRetry(java.lang.Class<? extends java.lang.Throwable>... doNotRetry)
List of exceptions to skip retry. When matching an exact match is used. So adding RuntimeException.class to this list is going to include only RuntimeException itself, not all of its subclasses. The reason for such behaviour is to be able to support server side retries without knowledge of Java exception hierarchy. When considering an exception type a cause ofActivityFailureException
andChildWorkflowFailureException
is looked at.Error
andCancellationException
are never retried and are not even passed to this filter.
-
build
public RetryOptions build()
Build RetryOptions without performing validation as validation should be done after merging withMethodRetry
.
-
validateBuildWithDefaults
public RetryOptions validateBuildWithDefaults()
Validates property values and builds RetryOptions with default values.
-
-