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 module hunt.pool.impl.DefaultPooledObjectInfoMBean;
18 
19 /**
20  * The interface that defines the information about pooled objects that will be
21  * exposed via JMX.
22  *
23  * NOTE: This interface exists only to define those attributes and methods that
24  *       will be made available via JMX. It must not be implemented by clients
25  *       as it is subject to change between major, minor and patch version
26  *       releases of commons pool. Clients that implement this interface may
27  *       not, therefore, be able to upgrade to a new minor or patch release
28  *       without requiring code changes.
29  *
30  */
31 interface DefaultPooledObjectInfoMBean {
32     /**
33      * Obtain the time (using the same basis as
34      * {@link DateTimeHelper.currentTimeMillis()}) that pooled object was created.
35      *
36      * @return The creation time for the pooled object
37      */
38     long getCreateTime();
39 
40     /**
41      * Obtain the time that pooled object was created.
42      *
43      * @return The creation time for the pooled object formatted as
44      *         <code>yyyy-MM-dd HH:mm:ss Z</code>
45      */
46     string getCreateTimeFormatted();
47 
48     /**
49      * Obtain the time (using the same basis as
50      * {@link DateTimeHelper.currentTimeMillis()}) the polled object was last borrowed.
51      *
52      * @return The time the pooled object was last borrowed
53      */
54     long getLastBorrowTime();
55 
56     /**
57      * Obtain the time that pooled object was last borrowed.
58      *
59      * @return The last borrowed time for the pooled object formated as
60      *         <code>yyyy-MM-dd HH:mm:ss Z</code>
61      */
62     string getLastBorrowTimeFormatted();
63 
64     /**
65      * Obtain the stack trace recorded when the pooled object was last borrowed.
66      *
67      * @return The stack trace showing which code last borrowed the pooled
68      *         object
69      */
70     string getLastBorrowTrace();
71 
72 
73     /**
74      * Obtain the time (using the same basis as
75      * {@link DateTimeHelper.currentTimeMillis()})the wrapped object was last returned.
76      *
77      * @return The time the object was last returned
78      */
79     long getLastReturnTime();
80 
81     /**
82      * Obtain the time that pooled object was last returned.
83      *
84      * @return The last returned time for the pooled object formated as
85      *         <code>yyyy-MM-dd HH:mm:ss Z</code>
86      */
87     string getLastReturnTimeFormatted();
88 
89     /**
90      * Obtain the name of the class of the pooled object.
91      *
92      * @return The pooled object's class name
93      *
94      * @typeid(see).name
95      */
96     string getPooledObjectType();
97 
98     /**
99      * Provides a string form of the wrapper for debug purposes. The format is
100      * not fixed and may change at any time.
101      *
102      * @return A string representation of the pooled object
103      *
104      * @see Object#toString()
105      */
106     string getPooledObjectToString();
107 
108     /**
109      * Get the number of times this object has been borrowed.
110      * @return The number of times this object has been borrowed.
111      */
112     long getBorrowedCount();
113 }