Class RetryPolicy.ExponentialBackoff

java.lang.Object
cloud.opencode.base.cache.spi.RetryPolicy.ExponentialBackoff
All Implemented Interfaces:
RetryPolicy
Enclosing interface:
RetryPolicy

public static final class RetryPolicy.ExponentialBackoff extends Object implements RetryPolicy
Exponential backoff implementation
Since:
JDK 25, opencode-base-cache V1.9.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • maxRetries

      public int maxRetries()
      Description copied from interface: RetryPolicy
      Get the maximum number of retry attempts 获取最大重试次数
      Specified by:
      maxRetries in interface RetryPolicy
      Returns:
      max retries (0 means no retry) | 最大重试次数(0 表示不重试)
    • getDelay

      public Duration getDelay(int attempt)
      Description copied from interface: RetryPolicy
      Calculate delay before the next retry attempt 计算下次重试前的延迟
      Specified by:
      getDelay in interface RetryPolicy
      Parameters:
      attempt - current attempt number (1-based) | 当前尝试次数(从 1 开始)
      Returns:
      delay before retry | 重试前的延迟