Enum Class LockType
- All Implemented Interfaces:
Serializable, Comparable<LockType>, Constable
Lock Type Enumeration
锁类型枚举
Defines the different types of locks available in the lock component.
定义锁组件中可用的不同锁类型。
Features | 主要功能:
- Type identification for lock configuration - 锁配置的类型标识
- Factory method selection support - 工厂方法选择支持
Usage Examples | 使用示例:
// Select a lock type for configuration
// 选择锁类型进行配置
LockType type = LockType.REENTRANT;
Lock lock = LockManager.create(type);
Security | 安全性:
- Thread-safe: Yes (immutable enum) - 线程安全: 是(不可变枚举)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-lock V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRead-write lock - allows concurrent readers, exclusive writers 读写锁 - 允许并发读取,排他写入Reentrant lock - allows recursive locking by same thread 可重入锁 - 允许同一线程递归锁定Segment lock - partitioned locks for fine-grained control 分段锁 - 用于细粒度控制的分区锁Spin lock - busy-waits for short critical sections 自旋锁 - 用于短临界区的忙等待Stamped lock - supports optimistic read locking 印戳锁 - 支持乐观读锁定 -
Method Summary
-
Enum Constant Details
-
REENTRANT
Reentrant lock - allows recursive locking by same thread 可重入锁 - 允许同一线程递归锁定 -
READ_WRITE
Read-write lock - allows concurrent readers, exclusive writers 读写锁 - 允许并发读取,排他写入 -
STAMPED
Stamped lock - supports optimistic read locking 印戳锁 - 支持乐观读锁定 -
SPIN
Spin lock - busy-waits for short critical sections 自旋锁 - 用于短临界区的忙等待 -
SEGMENT
Segment lock - partitioned locks for fine-grained control 分段锁 - 用于细粒度控制的分区锁
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-