public class ExponentialRetryPolicy extends RetryPolicyBase
Constructor and Description |
---|
ExponentialRetryPolicy(long initialRetryIntervalSeconds) |
Modifier and Type | Method and Description |
---|---|
double |
getBackoffCoefficient() |
long |
getInitialRetryIntervalSeconds() |
int |
getMaximumAttempts() |
long |
getMaximumRetryIntervalSeconds() |
long |
getRetryExpirationIntervalSeconds() |
long |
nextRetryDelaySeconds(Date firstAttempt,
Date recordedFailure,
int numberOfTries) |
void |
setBackoffCoefficient(double backoffCoefficient)
Coefficient used to calculate the next retry interval.
|
void |
setMaximumAttempts(int maximumAttempts)
Maximum number of attempts.
|
void |
setMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
Set the upper limit of retry interval.
|
void |
setRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
Stop retrying after the specified interval.
|
void |
validate()
Performs the following three validation checks for ExponentialRetry
Policy: 1) initialRetryIntervalSeconds is not greater than
maximumRetryIntervalSeconds 2) initialRetryIntervalSeconds is not greater
than retryExpirationIntervalSeconds
|
ExponentialRetryPolicy |
withBackoffCoefficient(double backoffCoefficient) |
ExponentialRetryPolicy |
withExceptionsToExclude(Collection<Class<? extends Throwable>> exceptionsToRetry)
The exception types that should not be retried.
|
ExponentialRetryPolicy |
withExceptionsToRetry(Collection<Class<? extends Throwable>> exceptionsToRetry)
The exception types that cause operation being retried.
|
ExponentialRetryPolicy |
withMaximumAttempts(int maximumAttempts) |
ExponentialRetryPolicy |
withMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds) |
ExponentialRetryPolicy |
withRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds) |
getExceptionsToExclude, getExceptionsToRetry, isRetryable, setExceptionsToExclude, setExceptionsToRetry
public ExponentialRetryPolicy(long initialRetryIntervalSeconds)
public long getInitialRetryIntervalSeconds()
public long getMaximumRetryIntervalSeconds()
public void setMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
public ExponentialRetryPolicy withMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
public long getRetryExpirationIntervalSeconds()
public void setRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
public ExponentialRetryPolicy withRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
public double getBackoffCoefficient()
public void setBackoffCoefficient(double backoffCoefficient)
initialRetryIntervalSeconds * Math.pow(backoffCoefficient, numberOfTries - 2)
public ExponentialRetryPolicy withBackoffCoefficient(double backoffCoefficient)
public int getMaximumAttempts()
public void setMaximumAttempts(int maximumAttempts)
public ExponentialRetryPolicy withMaximumAttempts(int maximumAttempts)
public ExponentialRetryPolicy withExceptionsToRetry(Collection<Class<? extends Throwable>> exceptionsToRetry)
withExceptionsToRetry
in class RetryPolicyBase
public ExponentialRetryPolicy withExceptionsToExclude(Collection<Class<? extends Throwable>> exceptionsToRetry)
withExceptionsToExclude
in class RetryPolicyBase
public long nextRetryDelaySeconds(Date firstAttempt, Date recordedFailure, int numberOfTries)
FlowConstants.NONE
means stop
retrying.public void validate() throws IllegalStateException
IllegalStateException