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 *
024 * NOTE: This interface exists only to define those attributes and methods that
025 *       will be made available via JMX. It must not be implemented by clients
026 *       as it is subject to change between major, minor and patch version
027 *       releases of commons pool. Clients that implement this interface may
028 *       not, therefore, be able to upgrade to a new minor or patch release
029 *       without requiring code changes.
030 *
031 * @since 2.0
032 */
033public interface GenericObjectPoolMXBean {
034
035    // Getters for basic configuration settings
036
037    /**
038     * See {@link GenericObjectPool#getBlockWhenExhausted()}
039     * @return See {@link GenericObjectPool#getBlockWhenExhausted()}
040     */
041    boolean getBlockWhenExhausted();
042
043    /**
044     * See {@link GenericObjectPool#getLifo()}
045     * @return See {@link GenericObjectPool#getLifo()}
046     */
047    boolean getFairness();
048
049    /**
050     * See {@link GenericObjectPool#getFairness()}
051     * @return See {@link GenericObjectPool#getFairness()}
052     */
053    boolean getLifo();
054
055    /**
056     * See {@link GenericObjectPool#getMaxIdle()}
057     * @return See {@link GenericObjectPool#getMaxIdle()}
058     */
059    int getMaxIdle();
060
061    /**
062     * See {@link GenericObjectPool#getMaxTotal()}
063     * @return See {@link GenericObjectPool#getMaxTotal()}
064     */
065    int getMaxTotal();
066
067    /**
068     * See {@link GenericObjectPool#getMaxWaitMillis()}
069     * @return See {@link GenericObjectPool#getMaxWaitMillis()}
070     */
071    long getMaxWaitMillis();
072
073    /**
074     * See {@link GenericObjectPool#getMinEvictableIdleTimeMillis()}
075     * @return See {@link GenericObjectPool#getMinEvictableIdleTimeMillis()}
076     */
077    long getMinEvictableIdleTimeMillis();
078
079    /**
080     * See {@link GenericObjectPool#getMinIdle()}
081     * @return See {@link GenericObjectPool#getMinIdle()}
082     */
083    int getMinIdle();
084
085    /**
086     * See {@link GenericObjectPool#getNumActive()}
087     * @return See {@link GenericObjectPool#getNumActive()}
088     */
089    int getNumActive();
090
091    /**
092     * See {@link GenericObjectPool#getNumIdle()}
093     * @return See {@link GenericObjectPool#getNumIdle()}
094     */
095    int getNumIdle();
096
097    /**
098     * See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
099     * @return See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
100     */
101    int getNumTestsPerEvictionRun();
102
103    /**
104     * See {@link GenericObjectPool#getTestOnCreate()}
105     * @return See {@link GenericObjectPool#getTestOnCreate()}
106     * @since 2.2
107     */
108    boolean getTestOnCreate();
109
110    /**
111     * See {@link GenericObjectPool#getTestOnBorrow()}
112     * @return See {@link GenericObjectPool#getTestOnBorrow()}
113     */
114    boolean getTestOnBorrow();
115
116    /**
117     * See {@link GenericObjectPool#getTestOnReturn()}
118     * @return See {@link GenericObjectPool#getTestOnReturn()}
119     */
120    boolean getTestOnReturn();
121
122    /**
123     * See {@link GenericObjectPool#getTestWhileIdle()}
124     * @return See {@link GenericObjectPool#getTestWhileIdle()}
125     */
126    boolean 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    boolean 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    boolean isAbandonedConfig();
221
222    /**
223     * See {@link GenericObjectPool#getLogAbandoned()}
224     * @return See {@link GenericObjectPool#getLogAbandoned()}
225     */
226    boolean getLogAbandoned();
227
228    /**
229     * See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
230     * @return See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
231     */
232    boolean getRemoveAbandonedOnBorrow();
233
234    /**
235     * See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
236     * @return See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
237     */
238    boolean 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}