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.GenericKeyedObjectPoolMXBean;
18 
19 import hunt.collection.List;
20 import hunt.collection.Map;
21 
22 
23 /**
24  * Defines the methods that will be made available via JMX.
25  *
26  * NOTE: This interface exists only to define those attributes and methods that
27  *       will be made available via JMX. It must not be implemented by clients
28  *       as it is subject to change between major, minor and patch version
29  *       releases of commons pool. Clients that implement this interface may
30  *       not, therefore, be able to upgrade to a new minor or patch release
31  *       without requiring code changes.
32  *
33  * @param <K> The type of keys maintained by the pool.
34  *
35  */
36 interface GenericKeyedObjectPoolMXBean(K) {
37 
38     // Expose getters for configuration settings
39 
40     /**
41      * See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
42      * @return See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
43      */
44     bool getBlockWhenExhausted();
45 
46     /**
47      * See {@link GenericKeyedObjectPool#getFairness()}
48      * @return See {@link GenericKeyedObjectPool#getFairness()}
49      */
50     bool getFairness();
51 
52     /**
53      * See {@link GenericKeyedObjectPool#getLifo()}
54      * @return See {@link GenericKeyedObjectPool#getLifo()}
55      */
56     bool getLifo();
57 
58     /**
59      * See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
60      * @return See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
61      */
62     int getMaxIdlePerKey();
63 
64     /**
65      * See {@link GenericKeyedObjectPool#getMaxTotal()}
66      * @return See {@link GenericKeyedObjectPool#getMaxTotal()}
67      */
68     int getMaxTotal();
69 
70     /**
71      * See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
72      * @return See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
73      */
74     int getMaxTotalPerKey();
75 
76     /**
77      * See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
78      * @return See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
79      */
80     long getMaxWaitMillis();
81 
82     /**
83      * See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
84      * @return See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
85      */
86     long getMinEvictableIdleTimeMillis();
87 
88     /**
89      * See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
90      * @return See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
91      */
92     int getMinIdlePerKey();
93 
94     /**
95      * See {@link GenericKeyedObjectPool#getNumActive()}
96      * @return See {@link GenericKeyedObjectPool#getNumActive()}
97      */
98     int getNumActive();
99 
100     /**
101      * See {@link GenericKeyedObjectPool#getNumIdle()}
102      * @return See {@link GenericKeyedObjectPool#getNumIdle()}
103      */
104     int getNumIdle();
105 
106     /**
107      * See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
108      * @return See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
109      */
110     int getNumTestsPerEvictionRun();
111 
112     /**
113      * See {@link GenericKeyedObjectPool#getTestOnCreate()}
114      * @return See {@link GenericKeyedObjectPool#getTestOnCreate()}
115      */
116     bool getTestOnCreate();
117 
118     /**
119      * See {@link GenericKeyedObjectPool#getTestOnBorrow()}
120      * @return See {@link GenericKeyedObjectPool#getTestOnBorrow()}
121      */
122     bool getTestOnBorrow();
123 
124     /**
125      * See {@link GenericKeyedObjectPool#getTestOnReturn()}
126      * @return See {@link GenericKeyedObjectPool#getTestOnReturn()}
127      */
128     bool getTestOnReturn();
129 
130     /**
131      * See {@link GenericKeyedObjectPool#getTestWhileIdle()}
132      * @return See {@link GenericKeyedObjectPool#getTestWhileIdle()}
133      */
134     bool getTestWhileIdle();
135 
136     /**
137      * See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
138      * @return See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
139      */
140     long getTimeBetweenEvictionRunsMillis();
141 
142     /**
143      * See {@link GenericKeyedObjectPool#isClosed()}
144      * @return See {@link GenericKeyedObjectPool#isClosed()}
145      */
146     bool isClosed();
147 
148     // Expose getters for monitoring attributes
149 
150     /**
151      * See {@link GenericKeyedObjectPool#getNumActivePerKey()}
152      * @return See {@link GenericKeyedObjectPool#getNumActivePerKey()}
153      */
154     Map!(string,Integer) getNumActivePerKey();
155 
156     /**
157      * See {@link GenericKeyedObjectPool#getBorrowedCount()}
158      * @return See {@link GenericKeyedObjectPool#getBorrowedCount()}
159      */
160     long getBorrowedCount();
161 
162     /**
163      * See {@link GenericKeyedObjectPool#getReturnedCount()}
164      * @return See {@link GenericKeyedObjectPool#getReturnedCount()}
165      */
166     long getReturnedCount();
167 
168     /**
169      * See {@link GenericKeyedObjectPool#getCreatedCount()}
170      * @return See {@link GenericKeyedObjectPool#getCreatedCount()}
171      */
172     long getCreatedCount();
173 
174     /**
175      * See {@link GenericKeyedObjectPool#getDestroyedCount()}
176      * @return See {@link GenericKeyedObjectPool#getDestroyedCount()}
177      */
178     long getDestroyedCount();
179 
180     /**
181      * See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
182      * @return See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
183      */
184     long getDestroyedByEvictorCount();
185 
186     /**
187      * See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
188      * @return See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
189      */
190     long getDestroyedByBorrowValidationCount();
191 
192     /**
193      * See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
194      * @return See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
195      */
196     long getMeanActiveTimeMillis();
197 
198     /**
199      * See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
200      * @return See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
201      */
202     long getMeanIdleTimeMillis();
203 
204     /**
205      * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
206      * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
207      */
208     long getMeanBorrowWaitTimeMillis();
209 
210     /**
211      * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
212      * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
213      */
214     long getMaxBorrowWaitTimeMillis();
215 
216     /**
217      * See {@link GenericKeyedObjectPool#getCreationStackTrace()}
218      * @return See {@link GenericKeyedObjectPool#getCreationStackTrace()}
219      */
220     string getCreationStackTrace();
221 
222     /**
223      * See {@link GenericKeyedObjectPool#getNumWaiters()}
224      * @return See {@link GenericKeyedObjectPool#getNumWaiters()}
225      */
226     int getNumWaiters();
227 
228     /**
229      * See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
230      * @return See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
231      */
232     Map!(string,Integer) getNumWaitersByKey();
233 
234     /**
235      * See {@link GenericKeyedObjectPool#listAllObjects()}
236      * @return See {@link GenericKeyedObjectPool#listAllObjects()}
237      */
238     Map!(string,List!(DefaultPooledObjectInfo)) listAllObjects();
239 }