public final class StopStrategies
extends java.lang.Object
StopStrategy
instances.Modifier and Type | Method and Description |
---|---|
static StopStrategy |
neverStop()
Returns a stop strategy which never stops retrying.
|
static StopStrategy |
stopAfterAttempt(int attemptNumber)
Returns a stop strategy which stops after N failed attempts.
|
static StopStrategy |
stopAfterDelay(long delayInMillis)
Returns a stop strategy which stops after a given delay.
|
public static StopStrategy neverStop()
public static StopStrategy stopAfterAttempt(int attemptNumber)
attemptNumber
- the number of failed attempts before stoppingattemptNumber
attemptspublic static StopStrategy stopAfterDelay(long delayInMillis)
StopStrategy
will check if the
amount of time that's passed from the first attempt has exceeded the
given delay amount. If it has exceeded this delay, then using this
strategy causes the retrying to stop.delayInMillis
- the delay, in milliseconds, starting from first attemptdelayInMillis
time in milliseconds