1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.tomcat.dbcp.pool2;
18
19 /**
20 * Provides the possible states that a {@link PooledObject} may be in.
21 *
22 * @since 2.0
23 */
24 public enum PooledObjectState {
25
26 /**
27 * In the queue, not in use.
28 */
29 IDLE,
30
31 /**
32 * In use.
33 */
34 ALLOCATED,
35
36 /**
37 * In the queue, currently being tested for possible eviction.
38 */
39 EVICTION,
40
41 /**
42 * Not in the queue, currently being tested for possible eviction. An
43 * attempt to borrow the object was made while being tested which removed it
44 * from the queue. It should be returned to the head of the queue once
45 * eviction testing completes.
46 * TODO: Consider allocating object and ignoring the result of the eviction
47 * test.
48 */
49 EVICTION_RETURN_TO_HEAD,
50
51 /**
52 * In the queue, currently being validated.
53 */
54 VALIDATION,
55
56 /**
57 * Not in queue, currently being validated. The object was borrowed while
58 * being validated and since testOnBorrow was configured, it was removed
59 * from the queue and pre-allocated. It should be allocated once validation
60 * completes.
61 */
62 VALIDATION_PREALLOCATED,
63
64 /**
65 * Not in queue, currently being validated. An attempt to borrow the object
66 * was made while previously being tested for eviction which removed it from
67 * the queue. It should be returned to the head of the queue once validation
68 * completes.
69 */
70 VALIDATION_RETURN_TO_HEAD,
71
72 /**
73 * Failed maintenance (e.g. eviction test or validation) and will be / has
74 * been destroyed
75 */
76 INVALID,
77
78 /**
79 * Deemed abandoned, to be invalidated.
80 */
81 ABANDONED,
82
83 /**
84 * Returning to the pool.
85 */
86 RETURNING
87 }
88