类 FixedBackOff
java.lang.Object
cn.taketoday.util.backoff.FixedBackOff
- 所有已实现的接口:
BackOff
A simple
BackOff implementation that provides a fixed interval
between two attempts and a maximum number of retries.- 从以下版本开始:
- 4.0
- 作者:
- Stephane Nicoll
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final longThe default recovery interval: 5000 ms = 5 seconds.private longprivate longstatic final longConstant value indicating an unlimited number of attempts. -
构造器概要
构造器构造器说明Create an instance with an interval of 5000L ms and an unlimited number of attempts.FixedBackOff(long interval, long maxAttempts) Create an instance. -
方法概要
修饰符和类型方法说明longReturn the interval between two attempts in milliseconds.longReturn the maximum number of attempts in milliseconds.voidsetInterval(long interval) Set the interval between two attempts in milliseconds.voidsetMaxAttempts(long maxAttempts) Set the maximum number of attempts in milliseconds.start()Start a new back off execution.
-
字段详细资料
-
DEFAULT_INTERVAL
public static final long DEFAULT_INTERVALThe default recovery interval: 5000 ms = 5 seconds.- 另请参阅:
-
UNLIMITED_ATTEMPTS
public static final long UNLIMITED_ATTEMPTSConstant value indicating an unlimited number of attempts.- 另请参阅:
-
interval
private long interval -
maxAttempts
private long maxAttempts
-
-
构造器详细资料
-
FixedBackOff
public FixedBackOff()Create an instance with an interval of 5000L ms and an unlimited number of attempts. -
FixedBackOff
public FixedBackOff(long interval, long maxAttempts) Create an instance.- 参数:
interval- the interval between two attemptsmaxAttempts- the maximum number of attempts
-
-
方法详细资料
-
setInterval
public void setInterval(long interval) Set the interval between two attempts in milliseconds. -
getInterval
public long getInterval()Return the interval between two attempts in milliseconds. -
setMaxAttempts
public void setMaxAttempts(long maxAttempts) Set the maximum number of attempts in milliseconds. -
getMaxAttempts
public long getMaxAttempts()Return the maximum number of attempts in milliseconds. -
start
从接口复制的说明:BackOffStart a new back off execution.- 指定者:
start在接口中BackOff- 返回:
- a fresh
BackOffExecutionready to be used
-