    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.pool2;
    018
    019/**
    020 * Provides the possible states that a {@link PooledObject} may be in.
    021 *
    022 * @since 2.0
    023 */
    024public enum PooledObjectState {
    025
    026    /**
    027     * In the queue, not in use.
    028     */
    029    IDLE,
    030
    031    /**
    032     * In use.
    033     */
    034    ALLOCATED,
    035
    036    /**
    037     * In the queue, currently being tested for possible eviction.
    038     */
    039    EVICTION,
    040
    041    /**
    042     * Not in the queue, currently being tested for possible eviction. An
    043     * attempt to borrow the object was made while being tested which removed it
    044     * from the queue. It should be returned to the head of the queue once
    045     * eviction testing completes.
    046     * TODO: Consider allocating object and ignoring the result of the eviction
    047     *       test.
    048     */
    049    EVICTION_RETURN_TO_HEAD,
    050
    051    /**
    052     * In the queue, currently being validated.
    053     */
    054    VALIDATION,
    055
    056    /**
    057     * Not in queue, currently being validated. The object was borrowed while
    058     * being validated and since testOnBorrow was configured, it was removed
    059     * from the queue and pre-allocated. It should be allocated once validation
    060     * completes.
    061     */
    062    VALIDATION_PREALLOCATED,
    063
    064    /**
    065     * Not in queue, currently being validated. An attempt to borrow the object
    066     * was made while previously being tested for eviction which removed it from
    067     * the queue. It should be returned to the head of the queue once validation
    068     * completes.
    069     */
    070    VALIDATION_RETURN_TO_HEAD,
    071
    072    /**
    073     * Failed maintenance (e.g. eviction test or validation) and will be / has
    074     * been destroyed
    075     */
    076    INVALID,
    077
    078    /**
    079     * Deemed abandoned, to be invalidated.
    080     */
    081    ABANDONED,
    082
    083    /**
    084     * Returning to the pool.
    085     */
    086    RETURNING
    087}