public class RetryPolicy extends Object
| Constructor and Description |
|---|
RetryPolicy()
Creates a RetryPolicy that always retries by default.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsRetries()
Returns whether the policy allows any retries at all based on the configured maxRetries and
maxDuration.
|
Duration |
getMaxDuration()
Returns the max duration.
|
int |
getMaxRetries()
Returns the max retries.
|
Duration |
getMaxRetryInterval()
Returns the max retry interval for backoff retries.
|
Duration |
getRetryInterval()
Returns the retry interval.
|
int |
getRetryIntervalMultiplier()
Returns the retry interval multiplier for backoff retries.
|
RetryPolicy |
withBackoff(Duration retryInterval,
Duration maxRetryInterval)
Sets the
retryInterval to pause for, exponentially backing of to the
maxRetryInterval multiplying successive intervals by a factor of 2. |
RetryPolicy |
withBackoff(Duration retryInterval,
Duration maxRetryInterval,
int retryIntervalMultiplier)
Sets the
retryInterval to pause for, exponentially backing of to the
maxRetryInterval multiplying successive intervals by the
retryIntervalMultiplier. |
RetryPolicy |
withMaxDuration(Duration maxDuration)
Sets the max duration of the RetryPolicy.
|
RetryPolicy |
withMaxRetries(int maxRetries)
Sets the max retries to perform.
|
RetryPolicy |
withRetryInterval(Duration retryInterval)
Sets the
retryInterval to pause for between retries. |
public RetryPolicy()
public boolean allowsRetries()
public Duration getMaxDuration()
withMaxDuration(Duration)public int getMaxRetries()
withMaxRetries(int)public Duration getMaxRetryInterval()
withBackoff(Duration, Duration)public Duration getRetryInterval()
public int getRetryIntervalMultiplier()
withBackoff(Duration, Duration, int)public RetryPolicy withBackoff(Duration retryInterval, Duration maxRetryInterval)
retryInterval to pause for, exponentially backing of to the
maxRetryInterval multiplying successive intervals by a factor of 2.NullPointerException - if retryInterval or maxRetryInterval are nullIllegalArgumentException - if retryInterval is <= 0, retryInterval is >=
maxRetryInterval or the retryIntervalMultiplier is <= 1public RetryPolicy withBackoff(Duration retryInterval, Duration maxRetryInterval, int retryIntervalMultiplier)
retryInterval to pause for, exponentially backing of to the
maxRetryInterval multiplying successive intervals by the
retryIntervalMultiplier.NullPointerException - if retryInterval or maxRetryInterval are nullIllegalArgumentException - if retryInterval is <= 0, retryInterval is >=
maxRetryInterval or the retryIntervalMultiplier is <= 1public RetryPolicy withMaxDuration(Duration maxDuration)
NullPointerException - if maxDuration is nullpublic RetryPolicy withMaxRetries(int maxRetries)
public RetryPolicy withRetryInterval(Duration retryInterval)
retryInterval to pause for between retries.NullPointerException - if retryInterval is nullIllegalStateException - if backoff intervals have already been set via
withBackoff(Duration, Duration) or
withBackoff(Duration, Duration, int)Copyright © 2013. All rights reserved.