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