类 FixedBackOffPolicy
java.lang.Object
infra.retry.backoff.StatelessBackOffPolicy
infra.retry.backoff.FixedBackOffPolicy
- 所有已实现的接口:
BackOffPolicy
,SleepingBackOffPolicy<FixedBackOffPolicy>
public class FixedBackOffPolicy
extends StatelessBackOffPolicy
implements SleepingBackOffPolicy<FixedBackOffPolicy>
Implementation of
BackOffPolicy
that pauses for a fixed period of time before
continuing. A pause is implemented using Sleeper.sleep(long)
.
setBackOffPeriod(long)
is thread-safe and it is safe to call
setBackOffPeriod(long)
during execution from multiple threads, however this may
cause a single retry operation to have pauses of different intervals.- 从以下版本开始:
- 4.0
- 作者:
- Rob Harrop, Dave Syer, Artem Bilan, Harry Yang
-
字段概要
字段修饰符和类型字段说明The back off period in milliseconds.private static final long
Default back off period - 1000ms.private Sleeper
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
backOffPeriodSupplier
(Supplier<Long> backOffPeriodSupplier) Set a supplier for the back off period in milliseconds.protected void
Pause for thesetBackOffPeriod(long)
.long
The backoff period in milliseconds.void
setBackOffPeriod
(long backOffPeriod) Set the back off period in milliseconds.void
setSleeper
(Sleeper sleeper) Public setter for theSleeper
strategy.toString()
withSleeper
(Sleeper sleeper) Clone the policy and return a new policy which uses the passed sleeper.从类继承的方法 infra.retry.backoff.StatelessBackOffPolicy
backOff, start
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口继承的方法 infra.retry.backoff.BackOffPolicy
backOff, start
-
字段详细资料
-
DEFAULT_BACK_OFF_PERIOD
private static final long DEFAULT_BACK_OFF_PERIODDefault back off period - 1000ms.- 另请参阅:
-
backOffPeriod
The back off period in milliseconds. Defaults to 1000ms. -
sleeper
-
-
构造器详细资料
-
FixedBackOffPolicy
public FixedBackOffPolicy()
-
-
方法详细资料
-
withSleeper
从接口复制的说明:SleepingBackOffPolicy
Clone the policy and return a new policy which uses the passed sleeper.- 指定者:
withSleeper
在接口中SleepingBackOffPolicy<FixedBackOffPolicy>
- 参数:
sleeper
- Target to be invoked any time the backoff policy sleeps- 返回:
- a clone of this policy which will have all of its backoff sleeps routed into the passed sleeper
-
setSleeper
Public setter for theSleeper
strategy.- 参数:
sleeper
- the sleeper to set defaults toThreadWaitSleeper
.
-
setBackOffPeriod
public void setBackOffPeriod(long backOffPeriod) Set the back off period in milliseconds. Cannot be < 1. Default value is 1000ms.- 参数:
backOffPeriod
- the back off period
-
backOffPeriodSupplier
Set a supplier for the back off period in milliseconds. Cannot be < 1. Default supplier supplies 1000ms.- 参数:
backOffPeriodSupplier
- the back off period
-
getBackOffPeriod
public long getBackOffPeriod()The backoff period in milliseconds.- 返回:
- the backoff period
-
doBackOff
Pause for thesetBackOffPeriod(long)
.- 指定者:
doBackOff
在类中StatelessBackOffPolicy
- 抛出:
BackOffInterruptedException
- if interrupted during sleep.
-
toString
-