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.GenericObjectPoolMXBean;
18 
19 import hunt.pool.impl.DefaultPooledObjectInfo;
20 
21 import hunt.collection.Set;
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  */
34 interface GenericObjectPoolMXBean {
35 
36     // Getters for basic configuration settings
37 
38     /**
39      * See {@link GenericObjectPool#getBlockWhenExhausted()}
40      * @return See {@link GenericObjectPool#getBlockWhenExhausted()}
41      */
42     bool getBlockWhenExhausted();
43 
44     /**
45      * See {@link GenericObjectPool#getLifo()}
46      * @return See {@link GenericObjectPool#getLifo()}
47      */
48     bool getFairness();
49 
50     /**
51      * See {@link GenericObjectPool#getFairness()}
52      * @return See {@link GenericObjectPool#getFairness()}
53      */
54     bool getLifo();
55 
56     /**
57      * See {@link GenericObjectPool#getMaxIdle()}
58      * @return See {@link GenericObjectPool#getMaxIdle()}
59      */
60     int getMaxIdle();
61 
62     /**
63      * See {@link GenericObjectPool#getMaxTotal()}
64      * @return See {@link GenericObjectPool#getMaxTotal()}
65      */
66     int getMaxTotal();
67 
68     /**
69      * See {@link GenericObjectPool#getMaxWaitMillis()}
70      * @return See {@link GenericObjectPool#getMaxWaitMillis()}
71      */
72     long getMaxWaitMillis();
73 
74     /**
75      * See {@link GenericObjectPool#getMinEvictableIdleTimeMillis()}
76      * @return See {@link GenericObjectPool#getMinEvictableIdleTimeMillis()}
77      */
78     long getMinEvictableIdleTimeMillis();
79 
80     /**
81      * See {@link GenericObjectPool#getMinIdle()}
82      * @return See {@link GenericObjectPool#getMinIdle()}
83      */
84     int getMinIdle();
85 
86     /**
87      * See {@link GenericObjectPool#getNumActive()}
88      * @return See {@link GenericObjectPool#getNumActive()}
89      */
90     int getNumActive();
91 
92     /**
93      * See {@link GenericObjectPool#getNumIdle()}
94      * @return See {@link GenericObjectPool#getNumIdle()}
95      */
96     int getNumIdle();
97 
98     /**
99      * See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
100      * @return See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
101      */
102     int getNumTestsPerEvictionRun();
103 
104     /**
105      * See {@link GenericObjectPool#getTestOnCreate()}
106      * @return See {@link GenericObjectPool#getTestOnCreate()}
107      */
108     bool getTestOnCreate();
109 
110     /**
111      * See {@link GenericObjectPool#getTestOnBorrow()}
112      * @return See {@link GenericObjectPool#getTestOnBorrow()}
113      */
114     bool getTestOnBorrow();
115 
116     /**
117      * See {@link GenericObjectPool#getTestOnReturn()}
118      * @return See {@link GenericObjectPool#getTestOnReturn()}
119      */
120     bool getTestOnReturn();
121 
122     /**
123      * See {@link GenericObjectPool#getTestWhileIdle()}
124      * @return See {@link GenericObjectPool#getTestWhileIdle()}
125      */
126     bool getTestWhileIdle();
127 
128     /**
129      * See {@link GenericObjectPool#getTimeBetweenEvictionRunsMillis()}
130      * @return See {@link GenericObjectPool#getTimeBetweenEvictionRunsMillis()}
131      */
132     long getTimeBetweenEvictionRunsMillis();
133 
134     /**
135      * See {@link GenericObjectPool#isClosed()}
136      * @return See {@link GenericObjectPool#isClosed()}
137      */
138     bool isClosed();
139 
140     // Getters for monitoring attributes
141 
142     /**
143      * See {@link GenericObjectPool#getBorrowedCount()}
144      * @return See {@link GenericObjectPool#getBorrowedCount()}
145      */
146     long getBorrowedCount();
147 
148     /**
149      * See {@link GenericObjectPool#getReturnedCount()}
150      * @return See {@link GenericObjectPool#getReturnedCount()}
151      */
152     long getReturnedCount();
153 
154     /**
155      * See {@link GenericObjectPool#getCreatedCount()}
156      * @return See {@link GenericObjectPool#getCreatedCount()}
157      */
158     long getCreatedCount();
159 
160     /**
161      * See {@link GenericObjectPool#getDestroyedCount()}
162      * @return See {@link GenericObjectPool#getDestroyedCount()}
163      */
164     long getDestroyedCount();
165 
166     /**
167      * See {@link GenericObjectPool#getDestroyedByEvictorCount()}
168      * @return See {@link GenericObjectPool#getDestroyedByEvictorCount()}
169      */
170     long getDestroyedByEvictorCount();
171 
172     /**
173      * See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}
174      * @return See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}
175      */
176     long getDestroyedByBorrowValidationCount();
177 
178     /**
179      * See {@link GenericObjectPool#getMeanActiveTimeMillis()}
180      * @return See {@link GenericObjectPool#getMeanActiveTimeMillis()}
181      */
182     long getMeanActiveTimeMillis();
183 
184     /**
185      * See {@link GenericObjectPool#getMeanIdleTimeMillis()}
186      * @return See {@link GenericObjectPool#getMeanIdleTimeMillis()}
187      */
188     long getMeanIdleTimeMillis();
189 
190     /**
191      * See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}
192      * @return See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}
193      */
194     long getMeanBorrowWaitTimeMillis();
195 
196     /**
197      * See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}
198      * @return See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}
199      */
200     long getMaxBorrowWaitTimeMillis();
201 
202     /**
203      * See {@link GenericObjectPool#getCreationStackTrace()}
204      * @return See {@link GenericObjectPool#getCreationStackTrace()}
205      */
206     string getCreationStackTrace();
207 
208     /**
209      * See {@link GenericObjectPool#getNumWaiters()}
210      * @return See {@link GenericObjectPool#getNumWaiters()}
211      */
212     int getNumWaiters();
213 
214     // Getters for abandoned object removal configuration
215 
216     /**
217      * See {@link GenericObjectPool#isAbandonedConfig()}
218      * @return See {@link GenericObjectPool#isAbandonedConfig()}
219      */
220     bool isAbandonedConfig();
221 
222     /**
223      * See {@link GenericObjectPool#getLogAbandoned()}
224      * @return See {@link GenericObjectPool#getLogAbandoned()}
225      */
226     bool getLogAbandoned();
227 
228     /**
229      * See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
230      * @return See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
231      */
232     bool getRemoveAbandonedOnBorrow();
233 
234     /**
235      * See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
236      * @return See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
237      */
238     bool getRemoveAbandonedOnMaintenance();
239 
240     /**
241      * See {@link GenericObjectPool#getRemoveAbandonedTimeout()}
242      * @return See {@link GenericObjectPool#getRemoveAbandonedTimeout()}
243      */
244     int getRemoveAbandonedTimeout();
245 
246     /**
247      * See {@link GenericObjectPool#getFactoryType()}
248      * @return See {@link GenericObjectPool#getFactoryType()}
249      */
250     string getFactoryType();
251 
252     /**
253      * See {@link GenericObjectPool#listAllObjects()}
254      * @return See {@link GenericObjectPool#listAllObjects()}
255      */
256     Set!(DefaultPooledObjectInfo) listAllObjects();
257 }