public class RetryPolicy extends net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>
| Constructor and Description |
|---|
RetryPolicy()
Creates a retry policy that retries forever.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsAttempts()
Returns whether the policy allows any attempts based on the configured maxAttempts and
maxDuration.
|
Duration |
getInterval()
Returns the interval between attempts.
|
int |
getIntervalMultiplier()
Returns the interval multiplier for backoff attempts.
|
int |
getMaxAttempts()
Returns the max attempts.
|
Duration |
getMaxDuration()
Returns the max duration to perform attempts for.
|
Duration |
getMaxInterval()
Returns the max interval between backoff attempts.
|
RetryPolicy |
withBackoff(Duration interval,
Duration maxInterval)
Sets the
interval to pause for between attempts, exponentially backing of to the
maxInterval multiplying successive intervals by a factor of 2. |
RetryPolicy |
withBackoff(Duration interval,
Duration maxInterval,
int intervalMultiplier)
Sets the
interval to pause for between attempts, exponentially backing of to the
maxInterval multiplying successive intervals by the intervalMultiplier. |
RetryPolicy |
withInterval(Duration interval)
Sets the
interval to pause for between attempts. |
RetryPolicy |
withMaxAttempts(int maxAttempts)
Sets the max number of attempts to perform.
|
RetryPolicy |
withMaxDuration(Duration maxDuration)
Sets the max duration to perform attempts for.
|
public boolean allowsAttempts()
allowsAttempts in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>public Duration getInterval()
getInterval in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>withInterval(Duration),
withBackoff(Duration, Duration),
withBackoff(Duration, Duration, int)public int getIntervalMultiplier()
getIntervalMultiplier in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>withBackoff(Duration, Duration, int)public int getMaxAttempts()
getMaxAttempts in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>withMaxAttempts(int)public Duration getMaxDuration()
getMaxDuration in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>withMaxDuration(Duration)public Duration getMaxInterval()
getMaxInterval in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>withBackoff(Duration, Duration)public RetryPolicy withBackoff(Duration interval, Duration maxInterval)
interval to pause for between attempts, exponentially backing of to the
maxInterval multiplying successive intervals by a factor of 2.withBackoff in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>NullPointerException - if interval or maxInterval are nullIllegalArgumentException - if interval is <= 0 or interval is >=
maxIntervalpublic RetryPolicy withBackoff(Duration interval, Duration maxInterval, int intervalMultiplier)
interval to pause for between attempts, exponentially backing of to the
maxInterval multiplying successive intervals by the intervalMultiplier.withBackoff in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>NullPointerException - if interval or maxInterval are nullIllegalArgumentException - if interval is <= 0, interval is >=
maxInterval or the intervalMultiplier is <= 1public RetryPolicy withInterval(Duration interval)
interval to pause for between attempts.withInterval in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>NullPointerException - if interval is nullIllegalStateException - if backoff intervals have already been set via
withBackoff(Duration, Duration) or
withBackoff(Duration, Duration, int)public RetryPolicy withMaxAttempts(int maxAttempts)
withMaxAttempts in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>public RetryPolicy withMaxDuration(Duration maxDuration)
withMaxDuration in class net.jodah.lyra.internal.RecurringPolicy<RetryPolicy>NullPointerException - if maxDuration is nullCopyright © 2017. All rights reserved.