Class DistributedLockConfig.Builder

java.lang.Object
cloud.opencode.base.lock.distributed.DistributedLockConfig.Builder
Enclosing class:
DistributedLockConfig

public static class DistributedLockConfig.Builder extends Object
Distributed Lock Configuration Builder 分布式锁配置构建器

Provides fluent API for building distributed lock configurations.

提供用于构建分布式锁配置的流式API。

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

    • Builder

      public Builder()
  • Method Details

    • lockTimeout

      public DistributedLockConfig.Builder lockTimeout(Duration timeout)
      Sets the timeout for lock acquisition 设置锁获取超时
      Parameters:
      timeout - the timeout duration | 超时时长
      Returns:
      this builder | 此构建器
    • leaseTime

      public DistributedLockConfig.Builder leaseTime(Duration duration)
      Sets the lease time (TTL) for the lock 设置锁的租约时间(TTL)
      Parameters:
      duration - the lease time duration | 租约时长
      Returns:
      this builder | 此构建器
    • renewInterval

      public DistributedLockConfig.Builder renewInterval(Duration interval)
      Sets the interval for automatic lock renewal 设置自动锁续期的间隔
      Parameters:
      interval - the renewal interval | 续期间隔
      Returns:
      this builder | 此构建器
    • autoRenew

      public DistributedLockConfig.Builder autoRenew(boolean autoRenew)
      Sets whether to enable automatic lock renewal 设置是否启用自动锁续期
      Parameters:
      autoRenew - true to enable auto-renewal | true表示启用自动续期
      Returns:
      this builder | 此构建器
    • retryCount

      public DistributedLockConfig.Builder retryCount(int count)
      Sets the number of retry attempts on failure 设置失败时的重试次数
      Parameters:
      count - the retry count | 重试次数
      Returns:
      this builder | 此构建器
    • retryInterval

      public DistributedLockConfig.Builder retryInterval(Duration interval)
      Sets the interval between retry attempts 设置重试尝试之间的间隔
      Parameters:
      interval - the retry interval | 重试间隔
      Returns:
      this builder | 此构建器
    • enableFencing

      public DistributedLockConfig.Builder enableFencing(boolean enable)
      Sets whether to enable fencing token for safe resource access 设置是否启用防护令牌以安全访问资源
      Parameters:
      enable - true to enable fencing | true表示启用防护
      Returns:
      this builder | 此构建器
    • build

      public DistributedLockConfig build()
      Builds the distributed lock configuration 构建分布式锁配置
      Returns:
      the configuration | 配置