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)
Deprecated.
Use
stopAfterDelay(long, TimeUnit) instead. |
static StopStrategy |
stopAfterDelay(long duration,
java.util.concurrent.TimeUnit timeUnit)
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 attempts@Deprecated public static StopStrategy stopAfterDelay(long delayInMillis)
stopAfterDelay(long, TimeUnit) instead.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 millisecondspublic static StopStrategy stopAfterDelay(long duration, @Nonnull java.util.concurrent.TimeUnit timeUnit)
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.duration - the delay, starting from first attempttimeUnit - the unit of the durationdelayInMillis time in milliseconds