public class AlwaysRetryStrategy extends Object implements RetryStrategy
RetryStrategy, 重试逻辑用于判断在发生异常时是否需要重试, 并给出本次重试的时间间隔.
AlwaysRetryStrategy为一个重试逻辑示例, 其在最大重试次数内总是重试.| 构造器和说明 |
|---|
AlwaysRetryStrategy() |
AlwaysRetryStrategy(int maxRetryTimes,
int maxRetryPauseInMillis) |
AlwaysRetryStrategy(int initialPauseInMillis,
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(int initialPauseInMillis,
int maxRetryTimes,
int maxRetryPauseInMillis)
public AlwaysRetryStrategy clone()
RetryStrategyclone 在接口中 RetryStrategyclone 在类中 Objectpublic int getRetries()
RetryStrategygetRetries 在接口中 RetryStrategypublic long nextPause(String action, Exception ex)
RetryStrategynextPause 在接口中 RetryStrategyaction - 操作名,比如"ListTable"、"GetRow"、"PutRow"等ex - 上次访问失败的错误信息、为ClientException或TableStoreExceptionpublic int getMaxRetryTimes()
public void setMaxRetryTimes(int maxRetryTimes)
public int getMaxRetryPauseInMillis()
public void setMaxRetryPauseInMillis(int maxRetryPauseInMillis)
Copyright © 2022. All Rights Reserved.