public final class StopStrategies extends Object
StopStrategy instances.| 限定符和类型 | 方法和说明 |
|---|---|
static StopStrategy |
join(StopStrategy... stopStrategies)
Joins one or more stop strategies to derive a composite stop strategy.
|
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 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 attemptspublic 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 millisecondspublic static StopStrategy join(StopStrategy... stopStrategies)
stopStrategies - stop strategies that need to be checked one by one.Copyright © 2019. All rights reserved.