public class AlwaysRetryStrategy extends Object implements RetryStrategy
RetryStrategy, 重试逻辑用于判断在发生异常时是否需要重试, 并给出本次重试的时间间隔.
AlwaysRetryStrategy为一个重试逻辑示例, 其在最大重试次数内总是重试.| Constructor and Description |
|---|
AlwaysRetryStrategy() |
AlwaysRetryStrategy(int maxRetryTimes,
int maxRetryPauseInMillis) |
AlwaysRetryStrategy(int initialPauseInMillis,
int maxRetryTimes,
int maxRetryPauseInMillis) |
| Modifier and Type | Method and Description |
|---|---|
AlwaysRetryStrategy |
clone()
返回一个同类型且尚未重试的RetryStrategy对象。
|
int |
getMaxRetryPauseInMillis() |
int |
getMaxRetryTimes() |
int |
getRetries()
返回当前重试的次数
|
long |
nextPause(String action,
Exception ex)
得到发起第retries次重试前延迟的时间。SDK会在这一段时间之后发起第retries次重试。
若返回值小于等于0, 表示不重试.
|
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 in interface RetryStrategyclone in class Objectpublic int getRetries()
RetryStrategygetRetries in interface RetryStrategypublic long nextPause(String action, Exception ex)
RetryStrategynextPause in interface RetryStrategyaction - 操作名,比如"ListTable"、"GetRow"、"PutRow"等ex - 上次访问失败的错误信息、为ClientException或TableStoreExceptionpublic int getMaxRetryTimes()
public void setMaxRetryTimes(int maxRetryTimes)
public int getMaxRetryPauseInMillis()
public void setMaxRetryPauseInMillis(int maxRetryPauseInMillis)
Copyright © 2024. All Rights Reserved.