Package cn.com.anysdk.redis.reconnect
Class FixedIntervalReconnectStrategy
java.lang.Object
cn.com.anysdk.redis.reconnect.FixedIntervalReconnectStrategy
- All Implemented Interfaces:
RedisReconnectStrategy
固定间隔重连策略
-
Constructor Summary
ConstructorsConstructorDescriptionFixedIntervalReconnectStrategy(long intervalMs, int maxRetryCount) 创建固定间隔重连策略 -
Method Summary
Modifier and TypeMethodDescriptionint获取最大重试次数getName()获取策略名称longgetNextWaitTime(int retryCount) 获取下一次重连的等待时间(毫秒)voidreset()重置重连策略状态
-
Constructor Details
-
FixedIntervalReconnectStrategy
public FixedIntervalReconnectStrategy(long intervalMs, int maxRetryCount) 创建固定间隔重连策略- Parameters:
intervalMs- 重连间隔(毫秒)maxRetryCount- 最大重试次数,-1表示无限重试
-
-
Method Details
-
getNextWaitTime
public long getNextWaitTime(int retryCount) Description copied from interface:RedisReconnectStrategy获取下一次重连的等待时间(毫秒)- Specified by:
getNextWaitTimein interfaceRedisReconnectStrategy- Parameters:
retryCount- 当前重试次数- Returns:
- 等待时间(毫秒)
-
getMaxRetryCount
public int getMaxRetryCount()Description copied from interface:RedisReconnectStrategy获取最大重试次数- Specified by:
getMaxRetryCountin interfaceRedisReconnectStrategy- Returns:
- 最大重试次数,-1表示无限重试
-
reset
public void reset()Description copied from interface:RedisReconnectStrategy重置重连策略状态- Specified by:
resetin interfaceRedisReconnectStrategy
-
getName
Description copied from interface:RedisReconnectStrategy获取策略名称- Specified by:
getNamein interfaceRedisReconnectStrategy- Returns:
- 策略名称
-