public class RecoveryPolicy extends net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>
| Constructor and Description |
|---|
RecoveryPolicy()
Creates a recovery policy that always recovers.
|
| 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.
|
RecoveryPolicy |
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. |
RecoveryPolicy |
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. |
RecoveryPolicy |
withInterval(Duration interval)
Sets the
interval to pause for between attempts. |
RecoveryPolicy |
withMaxAttempts(int maxAttempts)
Sets the max number of attempts to perform.
|
RecoveryPolicy |
withMaxDuration(Duration maxDuration)
Sets the max duration to perform attempts for.
|
public RecoveryPolicy()
public boolean allowsAttempts()
allowsAttempts in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>public Duration getInterval()
getInterval in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>withInterval(Duration),
withBackoff(Duration, Duration),
withBackoff(Duration, Duration, int)public int getIntervalMultiplier()
getIntervalMultiplier in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>withBackoff(Duration, Duration, int)public int getMaxAttempts()
getMaxAttempts in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>withMaxAttempts(int)public Duration getMaxDuration()
getMaxDuration in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>withMaxDuration(Duration)public Duration getMaxInterval()
getMaxInterval in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>withBackoff(Duration, Duration)public RecoveryPolicy 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<RecoveryPolicy>NullPointerException - if interval or maxInterval are nullIllegalArgumentException - if interval is <= 0 or interval is >=
maxIntervalpublic RecoveryPolicy 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<RecoveryPolicy>NullPointerException - if interval or maxInterval are nullIllegalArgumentException - if interval is <= 0, interval is >=
maxInterval or the intervalMultiplier is <= 1public RecoveryPolicy withInterval(Duration interval)
interval to pause for between attempts.withInterval in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>NullPointerException - if interval is nullIllegalStateException - if backoff intervals have already been set via
withBackoff(Duration, Duration) or
withBackoff(Duration, Duration, int)public RecoveryPolicy withMaxAttempts(int maxAttempts)
withMaxAttempts in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>public RecoveryPolicy withMaxDuration(Duration maxDuration)
withMaxDuration in class net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>NullPointerException - if maxDuration is nullCopyright © 2015. All rights reserved.