    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     * In the queue, not in use.
    027     */
    028    IDLE,
    029
    030    /**
    031     * In use.
    032     */
    033    ALLOCATED,
    034
    035    /**
    036     * In the queue, currently being tested for possible eviction.
    037     */
    038    EVICTION,
    039
    040    /**
    041     * Not in the queue, currently being tested for possible eviction. An
    042     * attempt to borrow the object was made while being tested which removed it
    043     * from the queue. It should be returned to the head of the queue once
    044     * eviction testing completes.
    045     * TODO: Consider allocating object and ignoring the result of the eviction
    046     *       test.
    047     */
    048    EVICTION_RETURN_TO_HEAD,
    049
    050    /**
    051     * In the queue, currently being validated.
    052     */
    053    VALIDATION,
    054
    055    /**
    056     * Not in queue, currently being validated. The object was borrowed while
    057     * being validated and since testOnBorrow was configured, it was removed
    058     * from the queue and pre-allocated. It should be allocated once validation
    059     * completes.
    060     */
    061    VALIDATION_PREALLOCATED,
    062
    063    /**
    064     * Not in queue, currently being validated. An attempt to borrow the object
    065     * was made while previously being tested for eviction which removed it from
    066     * the queue. It should be returned to the head of the queue once validation
    067     * completes.
    068     */
    069    VALIDATION_RETURN_TO_HEAD,
    070
    071    /**
    072     * Failed maintenance (e.g. eviction test or validation) and will be / has
    073     * been destroyed
    074     */
    075    INVALID,
    076
    077    /**
    078     * Deemed abandoned, to be invalidated.
    079     */
    080    ABANDONED,
    081
    082    /**
    083     * Returning to the pool.
    084     */
    085    RETURNING
    086}