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.impl;
018
019import java.util.Set;
020
021/**
022 * Defines the methods that will be made available via JMX.
023 * <h2>Note</h2>
024 * <p>
025 * This interface exists only to define those attributes and methods that will be made available via JMX. It must not be implemented by clients as it is subject
026 * to change between major, minor and patch version releases of commons pool. Clients that implement this interface may not, therefore, be able to upgrade to a
027 * new minor or patch release without requiring code changes.
028 * </p>
029 *
030 * @since 2.0
031 */
032public interface GenericObjectPoolMXBean {
033
034    /**
035     * See {@link GenericObjectPool#getBlockWhenExhausted()}.
036     *
037     * @return See {@link GenericObjectPool#getBlockWhenExhausted()}.
038     */
039    boolean getBlockWhenExhausted();
040
041    /**
042     * See {@link GenericObjectPool#getBorrowedCount()}.
043     *
044     * @return See {@link GenericObjectPool#getBorrowedCount()}.
045     */
046    long getBorrowedCount();
047
048    /**
049     * See {@link GenericObjectPool#getCreatedCount()}.
050     *
051     * @return See {@link GenericObjectPool#getCreatedCount()}.
052     */
053    long getCreatedCount();
054
055    /**
056     * See {@link GenericObjectPool#getCreationStackTrace()}.
057     *
058     * @return See {@link GenericObjectPool#getCreationStackTrace()}.
059     */
060    String getCreationStackTrace();
061
062    /**
063     * See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}.
064     *
065     * @return See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}.
066     */
067    long getDestroyedByBorrowValidationCount();
068
069    /**
070     * See {@link GenericObjectPool#getDestroyedByEvictorCount()}.
071     *
072     * @return See {@link GenericObjectPool#getDestroyedByEvictorCount()}.
073     */
074    long getDestroyedByEvictorCount();
075
076    /**
077     * See {@link GenericObjectPool#getDestroyedCount()}.
078     *
079     * @return See {@link GenericObjectPool#getDestroyedCount()}.
080     */
081    long getDestroyedCount();
082
083    /**
084     * See {@link GenericObjectPool#getFactoryType()}.
085     *
086     * @return See {@link GenericObjectPool#getFactoryType()}.
087     */
088    String getFactoryType();
089
090    /**
091     * See {@link GenericObjectPool#getLifo()}.
092     *
093     * @return See {@link GenericObjectPool#getLifo()}.
094     */
095    boolean getFairness();
096
097    /**
098     * See {@link GenericObjectPool#getFairness()}.
099     *
100     * @return See {@link GenericObjectPool#getFairness()}.
101     */
102    boolean getLifo();
103
104    /**
105     * See {@link GenericObjectPool#getLogAbandoned()}.
106     *
107     * @return See {@link GenericObjectPool#getLogAbandoned()}.
108     */
109    boolean getLogAbandoned();
110
111    /**
112     * See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}.
113     *
114     * @return See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}.
115     */
116    long getMaxBorrowWaitTimeMillis();
117
118    /**
119     * See {@link GenericObjectPool#getMaxIdle()}.
120     *
121     * @return See {@link GenericObjectPool#getMaxIdle()}.
122     */
123    int getMaxIdle();
124
125    /**
126     * See {@link GenericObjectPool#getMaxTotal()}.
127     *
128     * @return See {@link GenericObjectPool#getMaxTotal()}.
129     */
130    int getMaxTotal();
131
132    /**
133     * See {@link GenericObjectPool#getMaxWaitDuration()}.
134     *
135     * @return See {@link GenericObjectPool#getMaxWaitDuration()}.
136     */
137    long getMaxWaitMillis();
138
139    /**
140     * See {@link GenericObjectPool#getMeanActiveTimeMillis()}.
141     *
142     * @return See {@link GenericObjectPool#getMeanActiveTimeMillis()}.
143     */
144    long getMeanActiveTimeMillis();
145
146    /**
147     * See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}.
148     *
149     * @return See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}.
150     */
151    long getMeanBorrowWaitTimeMillis();
152
153    // Getters for monitoring attributes
154
155    /**
156     * See {@link GenericObjectPool#getMeanIdleTimeMillis()}.
157     *
158     * @return See {@link GenericObjectPool#getMeanIdleTimeMillis()}.
159     */
160    long getMeanIdleTimeMillis();
161
162    /**
163     * See {@link GenericObjectPool#getMinEvictableIdleDuration()}.
164     *
165     * @return See {@link GenericObjectPool#getMinEvictableIdleDuration()}.
166     */
167    long getMinEvictableIdleTimeMillis();
168
169    /**
170     * See {@link GenericObjectPool#getMinIdle()}.
171     *
172     * @return See {@link GenericObjectPool#getMinIdle()}.
173     */
174    int getMinIdle();
175
176    /**
177     * See {@link GenericObjectPool#getNumActive()}.
178     *
179     * @return See {@link GenericObjectPool#getNumActive()}.
180     */
181    int getNumActive();
182
183    /**
184     * See {@link GenericObjectPool#getNumIdle()}.
185     *
186     * @return See {@link GenericObjectPool#getNumIdle()}.
187     */
188    int getNumIdle();
189
190    /**
191     * See {@link GenericObjectPool#getNumTestsPerEvictionRun()}.
192     *
193     * @return See {@link GenericObjectPool#getNumTestsPerEvictionRun()}.
194     */
195    int getNumTestsPerEvictionRun();
196
197    /**
198     * See {@link GenericObjectPool#getNumWaiters()}.
199     *
200     * @return See {@link GenericObjectPool#getNumWaiters()}.
201     */
202    int getNumWaiters();
203
204    /**
205     * See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}.
206     *
207     * @return See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}.
208     */
209    boolean getRemoveAbandonedOnBorrow();
210
211    /**
212     * See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}.
213     *
214     * @return See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}.
215     */
216    boolean getRemoveAbandonedOnMaintenance();
217
218    /**
219     * See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}.
220     *
221     * @return See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}.
222     */
223    int getRemoveAbandonedTimeout();
224
225    /**
226     * See {@link GenericObjectPool#getReturnedCount()}.
227     *
228     * @return See {@link GenericObjectPool#getReturnedCount()}.
229     */
230    long getReturnedCount();
231
232    /**
233     * See {@link GenericObjectPool#getTestOnBorrow()}.
234     *
235     * @return See {@link GenericObjectPool#getTestOnBorrow()}.
236     */
237    boolean getTestOnBorrow();
238
239    // Getters for abandoned object removal configuration
240
241    /**
242     * See {@link GenericObjectPool#getTestOnCreate()}.
243     *
244     * @return See {@link GenericObjectPool#getTestOnCreate()}.
245     * @since 2.2
246     */
247    boolean getTestOnCreate();
248
249    /**
250     * See {@link GenericObjectPool#getTestOnReturn()}.
251     *
252     * @return See {@link GenericObjectPool#getTestOnReturn()}.
253     */
254    boolean getTestOnReturn();
255
256    /**
257     * See {@link GenericObjectPool#getTestWhileIdle()}.
258     *
259     * @return See {@link GenericObjectPool#getTestWhileIdle()}.
260     */
261    boolean getTestWhileIdle();
262
263    /**
264     * See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}.
265     *
266     * @return See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}.
267     */
268    long getTimeBetweenEvictionRunsMillis();
269
270    /**
271     * See {@link GenericObjectPool#isAbandonedConfig()}.
272     *
273     * @return See {@link GenericObjectPool#isAbandonedConfig()}.
274     */
275    boolean isAbandonedConfig();
276
277    /**
278     * See {@link GenericObjectPool#isClosed()}.
279     *
280     * @return See {@link GenericObjectPool#isClosed()}.
281     */
282    boolean isClosed();
283
284    /**
285     * See {@link GenericObjectPool#listAllObjects()}.
286     *
287     * @return See {@link GenericObjectPool#listAllObjects()}.
288     */
289    Set<DefaultPooledObjectInfo> listAllObjects();
290}