public final class StopStrategies extends Object
StopStrategy instances.| 限定符和类型 | 方法和说明 |
|---|---|
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)
已过时。
Use
stopAfterDelay(long, TimeUnit) instead. |
static StopStrategy |
stopAfterDelay(long duration,
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 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 millisecondsCopyright © 2023. All rights reserved.