Enum Class PooledObjectState

java.lang.Object
java.lang.Enum<PooledObjectState>
cloud.opencode.base.pool.factory.PooledObjectState
All Implemented Interfaces:
Serializable, Comparable<PooledObjectState>, Constable

public enum PooledObjectState extends Enum<PooledObjectState>
PooledObjectState - Pooled Object State Enumeration PooledObjectState - 池化对象状态枚举

Defines the lifecycle states of a pooled object.

定义池化对象的生命周期状态。

State Transitions | 状态转换:

IDLE -> ALLOCATED (borrow)
ALLOCATED -> RETURNING -> IDLE (return)
IDLE -> EVICTION -> INVALID (evict)
ALLOCATED -> INVALID (invalidate)
Any -> ABANDONED (timeout detection)

Features | 主要功能:

  • State tracking for pooled objects - 池化对象状态追踪
  • Thread-safe state transitions - 线程安全的状态转换
  • Lifecycle management support - 生命周期管理支持

Usage Examples | 使用示例:

PooledObjectState state = pooledObject.getState();
if (state == PooledObjectState.IDLE) {
    // Object available for borrowing
}
Since:
JDK 25, opencode-base-pool V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • IDLE

      public static final PooledObjectState IDLE
      Object is idle in the pool, available for borrowing. 对象空闲在池中,可被借用。
    • ALLOCATED

      public static final PooledObjectState ALLOCATED
      Object has been allocated to a client. 对象已被分配给客户端。
    • EVICTION

      public static final PooledObjectState EVICTION
      Object is being evicted from the pool. 对象正在被从池中驱逐。
    • VALIDATION

      public static final PooledObjectState VALIDATION
      Object is being validated. 对象正在被验证。
    • INVALID

      public static final PooledObjectState INVALID
      Object has been invalidated and will be destroyed. 对象已失效,将被销毁。
    • RETURNING

      public static final PooledObjectState RETURNING
      Object is being returned to the pool. 对象正在被归还到池中。
    • ABANDONED

      public static final PooledObjectState ABANDONED
      Object has been abandoned (not returned within timeout). 对象已被废弃(超时未归还)。
  • Method Details

    • values

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