Enum Class LockType

java.lang.Object
java.lang.Enum<LockType>
cloud.opencode.base.lock.LockType
All Implemented Interfaces:
Serializable, Comparable<LockType>, Constable

public enum LockType extends Enum<LockType>
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 Constants
    Enum Constant
    Description
    Read-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

    Modifier and Type
    Method
    Description
    static LockType
    Returns the enum constant of this class with the specified name.
    static LockType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • REENTRANT

      public static final LockType REENTRANT
      Reentrant lock - allows recursive locking by same thread 可重入锁 - 允许同一线程递归锁定
    • READ_WRITE

      public static final LockType READ_WRITE
      Read-write lock - allows concurrent readers, exclusive writers 读写锁 - 允许并发读取,排他写入
    • STAMPED

      public static final LockType STAMPED
      Stamped lock - supports optimistic read locking 印戳锁 - 支持乐观读锁定
    • SPIN

      public static final LockType SPIN
      Spin lock - busy-waits for short critical sections 自旋锁 - 用于短临界区的忙等待
    • SEGMENT

      public static final LockType SEGMENT
      Segment lock - partitioned locks for fine-grained control 分段锁 - 用于细粒度控制的分区锁
  • Method Details

    • values

      public static LockType[] 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

      public static LockType valueOf(String name)
      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 name
      NullPointerException - if the argument is null