Class RecoveryPolicy

java.lang.Object
net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>
net.jodah.lyra.config.RecoveryPolicy

public class RecoveryPolicy
extends net.jodah.lyra.internal.RecurringPolicy<RecoveryPolicy>
Policy that defines how recovery should be performed.
  • Constructor Summary

    Constructors 
    Constructor Description
    RecoveryPolicy()
    Creates a recovery policy that always recovers.
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait