Class DistributedLockConfig.Builder
java.lang.Object
cloud.opencode.base.lock.distributed.DistributedLockConfig.Builder
- Enclosing class:
DistributedLockConfig
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoRenew(boolean autoRenew) Sets whether to enable automatic lock renewal 设置是否启用自动锁续期build()Builds the distributed lock configuration 构建分布式锁配置enableFencing(boolean enable) Sets whether to enable fencing token for safe resource access 设置是否启用防护令牌以安全访问资源Sets the lease time (TTL) for the lock 设置锁的租约时间(TTL)lockTimeout(Duration timeout) Sets the timeout for lock acquisition 设置锁获取超时renewInterval(Duration interval) Sets the interval for automatic lock renewal 设置自动锁续期的间隔retryCount(int count) Sets the number of retry attempts on failure 设置失败时的重试次数retryInterval(Duration interval) Sets the interval between retry attempts 设置重试尝试之间的间隔
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
lockTimeout
Sets the timeout for lock acquisition 设置锁获取超时- Parameters:
timeout- the timeout duration | 超时时长- Returns:
- this builder | 此构建器
-
leaseTime
Sets the lease time (TTL) for the lock 设置锁的租约时间(TTL)- Parameters:
duration- the lease time duration | 租约时长- Returns:
- this builder | 此构建器
-
renewInterval
Sets the interval for automatic lock renewal 设置自动锁续期的间隔- Parameters:
interval- the renewal interval | 续期间隔- Returns:
- this builder | 此构建器
-
autoRenew
Sets whether to enable automatic lock renewal 设置是否启用自动锁续期- Parameters:
autoRenew- true to enable auto-renewal | true表示启用自动续期- Returns:
- this builder | 此构建器
-
retryCount
Sets the number of retry attempts on failure 设置失败时的重试次数- Parameters:
count- the retry count | 重试次数- Returns:
- this builder | 此构建器
-
retryInterval
Sets the interval between retry attempts 设置重试尝试之间的间隔- Parameters:
interval- the retry interval | 重试间隔- Returns:
- this builder | 此构建器
-
enableFencing
Sets whether to enable fencing token for safe resource access 设置是否启用防护令牌以安全访问资源- Parameters:
enable- true to enable fencing | true表示启用防护- Returns:
- this builder | 此构建器
-
build
Builds the distributed lock configuration 构建分布式锁配置- Returns:
- the configuration | 配置
-