PooledObjectState (Apache Tomcat 9.0.69 API Documentation)

Package org.apache.tomcat.dbcp.pool2

## Enum PooledObjectState

- java.lang.Object
- - java.lang.Enum<PooledObjectState>
  - - org.apache.tomcat.dbcp.pool2.PooledObjectState

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Comparable<PooledObjectState>`

      public enum PooledObjectState
      extends java.lang.Enum<PooledObjectState>

  Provides all possible states of a `PooledObject`.
  Since:
    2.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant | Description
    --- | ---
    `ABANDONED` | Deemed abandoned, to be invalidated.
    `ALLOCATED` | In use.
    `EVICTION` | In the queue, currently being tested for possible eviction.
    `EVICTION_RETURN_TO_HEAD` | Not in the queue, currently being tested for possible eviction.
    `IDLE` | In the queue, not in use.
    `INVALID` | Failed maintenance (e.g. eviction test or validation) and will be / has been destroyed
    `RETURNING` | Returning to the pool.
    `VALIDATION` | In the queue, currently being validated.
    `VALIDATION_PREALLOCATED` | Not in queue, currently being validated.
    `VALIDATION_RETURN_TO_HEAD` | Not in queue, currently being validated.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static PooledObjectState` | `valueOf​(java.lang.String name)` | Returns the enum constant of this type with the specified name.
    `static PooledObjectState[]` | `values()` | Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### IDLE

          public static final PooledObjectState IDLE

      In the queue, not in use.

    - #### ALLOCATED

          public static final PooledObjectState ALLOCATED

      In use.

    - #### EVICTION

          public static final PooledObjectState EVICTION

      In the queue, currently being tested for possible eviction.

    - #### EVICTION_RETURN_TO_HEAD

          public static final PooledObjectState EVICTION_RETURN_TO_HEAD

      Not in the queue, currently being tested for possible eviction. An attempt to borrow the object was made while being tested which removed it from the queue. It should be returned to the head of the queue once eviction testing completes.

      TODO: Consider allocating object and ignoring the result of the eviction test.

    - #### VALIDATION

          public static final PooledObjectState VALIDATION

      In the queue, currently being validated.

    - #### VALIDATION_PREALLOCATED

          public static final PooledObjectState VALIDATION_PREALLOCATED

      Not in queue, currently being validated. The object was borrowed while being validated and since testOnBorrow was configured, it was removed from the queue and pre-allocated. It should be allocated once validation completes.

    - #### VALIDATION_RETURN_TO_HEAD

          public static final PooledObjectState VALIDATION_RETURN_TO_HEAD

      Not in queue, currently being validated. An attempt to borrow the object was made while previously being tested for eviction which removed it from the queue. It should be returned to the head of the queue once validation completes.

    - #### INVALID

          public static final PooledObjectState INVALID

      Failed maintenance (e.g. eviction test or validation) and will be / has been destroyed

    - #### ABANDONED

          public static final PooledObjectState ABANDONED

      Deemed abandoned, to be invalidated.

    - #### RETURNING

          public static final PooledObjectState RETURNING

      Returning to the pool.

  - ### Method Detail

    - #### values

          public static PooledObjectState[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (PooledObjectState c : PooledObjectState.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static PooledObjectState valueOf​(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null