Package com.github.phantomthief.scope
Interface RetryPolicy
public interface RetryPolicy
- Author:
- w.vela Created on 2019-01-07.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean判断抛出某个异常后,是否要终止重试default booleanhedge()返回true则不cancel任何一次重试,重试过程中任何一次返回成功都拿来做最终结果 返回false则开始下一次重试时,之前超时的请求就算后来结果成功返回也没有用static RetryPolicynoRetry()longretry(int retryCount) static RetryPolicyretryNTimes(int times) static RetryPolicyretryNTimes(int times, long delayInMs) static RetryPolicyretryNTimes(int times, long delayInMs, boolean hedge) default boolean
-
Field Details
-
NO_RETRY
static final long NO_RETRY- See Also:
-
-
Method Details
-
noRetry
-
retryNTimes
-
retryNTimes
-
retryNTimes
-
retry
long retry(int retryCount) - Parameters:
retryCount- 当前重试的次数(1为第一次重试)- Returns:
- 下次重试的间隔时间,或者返回
NO_RETRY
-
hedge
default boolean hedge()返回true则不cancel任何一次重试,重试过程中任何一次返回成功都拿来做最终结果 返回false则开始下一次重试时,之前超时的请求就算后来结果成功返回也没有用 -
triggerGetOnTimeout
default boolean triggerGetOnTimeout() -
abortRetry
判断抛出某个异常后,是否要终止重试
-