public class AlwaysRetryStrategy extends Object implements RetryStrategy
RetryStrategy
, 重试逻辑用于判断在发生异常时是否需要重试, 并给出本次重试的时间间隔.
AlwaysRetryStrategy
为一个重试逻辑示例, 其在最大重试次数内总是重试.构造器和说明 |
---|
AlwaysRetryStrategy() |
AlwaysRetryStrategy(int maxRetryTimes,
int maxRetryPauseInMillis) |
限定符和类型 | 方法和说明 |
---|---|
AlwaysRetryStrategy |
clone()
返回一个同类型且尚未重试的RetryStrategy对象。
|
int |
getMaxRetryPauseInMillis() |
int |
getMaxRetryTimes() |
int |
getRetries()
返回当前重试的次数
|
long |
nextPause(String action,
Exception ex)
得到发起第retries次重试前延迟的时间。
|
void |
setMaxRetryPauseInMillis(int maxRetryPauseInMillis) |
void |
setMaxRetryTimes(int maxRetryTimes) |
public AlwaysRetryStrategy()
public AlwaysRetryStrategy(int maxRetryTimes, int maxRetryPauseInMillis)
public AlwaysRetryStrategy clone()
RetryStrategy
clone
在接口中 RetryStrategy
clone
在类中 Object
public int getRetries()
RetryStrategy
getRetries
在接口中 RetryStrategy
public long nextPause(String action, Exception ex)
RetryStrategy
nextPause
在接口中 RetryStrategy
action
- 操作名,比如"ListTable"、"GetRow"、"PutRow"等ex
- 上次访问失败的错误信息、为ClientException或TableStoreExceptionpublic int getMaxRetryTimes()
public void setMaxRetryTimes(int maxRetryTimes)
public int getMaxRetryPauseInMillis()
public void setMaxRetryPauseInMillis(int maxRetryPauseInMillis)
Copyright © 2018. All Rights Reserved.