Class RetryLock.Builder<T>

java.lang.Object
cloud.opencode.base.lock.local.RetryLock.Builder<T>
Type Parameters:
T - the type of lock token | 锁令牌类型
Enclosing class:
RetryLock<T>

public static class RetryLock.Builder<T> extends Object
Builder for RetryLock Configuration RetryLock 配置构建器

Provides a fluent API for configuring retry behavior.

提供流式API用于配置重试行为。

Since:
JDK 25, opencode-base-lock V1.0.3
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • maxRetries

      public RetryLock.Builder<T> maxRetries(int maxRetries)
      Sets the maximum number of retry attempts 设置最大重试次数
      Parameters:
      maxRetries - the max retries (>= 0) | 最大重试次数(>= 0)
      Returns:
      this builder | 此构建器
    • retryDelay

      public RetryLock.Builder<T> retryDelay(Duration retryDelay)
      Sets the initial delay between retries 设置重试之间的初始延迟
      Parameters:
      retryDelay - the initial delay | 初始延迟
      Returns:
      this builder | 此构建器
    • backoffMultiplier

      public RetryLock.Builder<T> backoffMultiplier(double backoffMultiplier)
      Sets the backoff multiplier 设置退避倍数
      Parameters:
      backoffMultiplier - the multiplier (>= 1.0) | 倍数(>= 1.0)
      Returns:
      this builder | 此构建器
    • maxDelay

      public RetryLock.Builder<T> maxDelay(Duration maxDelay)
      Sets the maximum delay cap 设置最大延迟上限
      Parameters:
      maxDelay - the max delay | 最大延迟
      Returns:
      this builder | 此构建器
    • build

      public RetryLock<T> build()
      Builds the configured RetryLock 构建配置好的 RetryLock
      Returns:
      a new RetryLock instance | 新的 RetryLock 实例