Class LockGroup.Builder
java.lang.Object
cloud.opencode.base.lock.manager.LockGroup.Builder
- Enclosing class:
LockGroup
Lock Group Builder for Fluent API
锁组构建器 - 流式API
Provides fluent API for building lock groups.
提供用于构建锁组的流式API。
- Since:
- JDK 25, opencode-base-lock V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a lock to the group 添加锁到组addAll(Collection<? extends Lock<?>> locks) Adds multiple locks to the group 添加多个锁到组build()Builds the lock group 构建锁组Sets the timeout for acquiring all locks 设置获取所有锁的超时
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
add
Adds a lock to the group 添加锁到组- Parameters:
lock- the lock to add | 要添加的锁- Returns:
- this builder | 此构建器
-
addAll
Adds multiple locks to the group 添加多个锁到组- Parameters:
locks- the locks to add | 要添加的锁集合- Returns:
- this builder | 此构建器
-
timeout
Sets the timeout for acquiring all locks 设置获取所有锁的超时- Parameters:
timeout- the timeout duration | 超时时长- Returns:
- this builder | 此构建器
-
build
Builds the lock group 构建锁组- Returns:
- the lock group | 锁组
- Throws:
IllegalArgumentException- if no locks were added | 如果未添加锁则抛出异常
-