Class RetryPolicy.CustomRetryPolicy
java.lang.Object
cloud.opencode.base.cache.spi.RetryPolicy.CustomRetryPolicy
- All Implemented Interfaces:
RetryPolicy
- Enclosing interface:
RetryPolicy
Custom retry policy implementation - wraps a delegate with custom exception filter
自定义重试策略实现 - 用自定义异常过滤器包装委托
- Since:
- JDK 25, opencode-base-cache V1.9.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface RetryPolicy
RetryPolicy.CustomRetryPolicy, RetryPolicy.ExponentialBackoff, RetryPolicy.FixedDelay, RetryPolicy.NoRetry -
Method Summary
Modifier and TypeMethodDescriptiongetDelay(int attempt) Calculate delay before the next retry attempt 计算下次重试前的延迟intGet the maximum number of retry attempts 获取最大重试次数booleanshouldRetry(Throwable exception) Check if the exception should trigger a retry 检查异常是否应触发重试Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RetryPolicy
retryOn
-
Method Details
-
maxRetries
public int maxRetries()Description copied from interface:RetryPolicyGet the maximum number of retry attempts 获取最大重试次数- Specified by:
maxRetriesin interfaceRetryPolicy- Returns:
- max retries (0 means no retry) | 最大重试次数(0 表示不重试)
-
getDelay
Description copied from interface:RetryPolicyCalculate delay before the next retry attempt 计算下次重试前的延迟- Specified by:
getDelayin interfaceRetryPolicy- Parameters:
attempt- current attempt number (1-based) | 当前尝试次数(从 1 开始)- Returns:
- delay before retry | 重试前的延迟
-
shouldRetry
Description copied from interface:RetryPolicyCheck if the exception should trigger a retry 检查异常是否应触发重试- Specified by:
shouldRetryin interfaceRetryPolicy- Parameters:
exception- the exception | 异常- Returns:
- true if should retry | 应重试返回 true
-