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.List;
020import java.util.Map;
021
022/**
023 * Defines the methods that will be made available via JMX.
024 *
025 * NOTE: This interface exists only to define those attributes and methods that
026 *       will be made available via JMX. It must not be implemented by clients
027 *       as it is subject to change between major, minor and patch version
028 *       releases of commons pool. Clients that implement this interface may
029 *       not, therefore, be able to upgrade to a new minor or patch release
030 *       without requiring code changes.
031 *
032 * @param <K> The type of keys maintained by the pool.
033 *
034 * @version $Revision: $
035 *
036 * @since 2.0
037 */
038public interface GenericKeyedObjectPoolMXBean<K> {
039    // Expose getters for configuration settings
040    /**
041     * See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
042     * @return See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
043     */
044    boolean getBlockWhenExhausted();
045    /**
046     * See {@link GenericKeyedObjectPool#getFairness()}
047     * @return See {@link GenericKeyedObjectPool#getFairness()}
048     */
049    boolean getFairness();
050    /**
051     * See {@link GenericKeyedObjectPool#getLifo()}
052     * @return See {@link GenericKeyedObjectPool#getLifo()}
053     */
054    boolean getLifo();
055    /**
056     * See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
057     * @return See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
058     */
059    int getMaxIdlePerKey();
060    /**
061     * See {@link GenericKeyedObjectPool#getMaxTotal()}
062     * @return See {@link GenericKeyedObjectPool#getMaxTotal()}
063     */
064    int getMaxTotal();
065    /**
066     * See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
067     * @return See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
068     */
069    int getMaxTotalPerKey();
070    /**
071     * See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
072     * @return See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
073     */
074    long getMaxWaitMillis();
075    /**
076     * See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
077     * @return See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
078     */
079    long getMinEvictableIdleTimeMillis();
080    /**
081     * See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
082     * @return See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
083     */
084    int getMinIdlePerKey();
085    /**
086     * See {@link GenericKeyedObjectPool#getNumActive()}
087     * @return See {@link GenericKeyedObjectPool#getNumActive()}
088     */
089    int getNumActive();
090    /**
091     * See {@link GenericKeyedObjectPool#getNumIdle()}
092     * @return See {@link GenericKeyedObjectPool#getNumIdle()}
093     */
094    int getNumIdle();
095    /**
096     * See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
097     * @return See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
098     */
099    int getNumTestsPerEvictionRun();
100    /**
101     * See {@link GenericKeyedObjectPool#getTestOnCreate()}
102     * @return See {@link GenericKeyedObjectPool#getTestOnCreate()}
103     * @since 2.2
104     */
105    boolean getTestOnCreate();
106    /**
107     * See {@link GenericKeyedObjectPool#getTestOnBorrow()}
108     * @return See {@link GenericKeyedObjectPool#getTestOnBorrow()}
109     */
110    boolean getTestOnBorrow();
111    /**
112     * See {@link GenericKeyedObjectPool#getTestOnReturn()}
113     * @return See {@link GenericKeyedObjectPool#getTestOnReturn()}
114     */
115    boolean getTestOnReturn();
116    /**
117     * See {@link GenericKeyedObjectPool#getTestWhileIdle()}
118     * @return See {@link GenericKeyedObjectPool#getTestWhileIdle()}
119     */
120    boolean getTestWhileIdle();
121    /**
122     * See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
123     * @return See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
124     */
125    long getTimeBetweenEvictionRunsMillis();
126    /**
127     * See {@link GenericKeyedObjectPool#isClosed()}
128     * @return See {@link GenericKeyedObjectPool#isClosed()}
129     */
130    boolean isClosed();
131    // Expose getters for monitoring attributes
132    /**
133     * See {@link GenericKeyedObjectPool#getNumActivePerKey()}
134     * @return See {@link GenericKeyedObjectPool#getNumActivePerKey()}
135     */
136    Map<String,Integer> getNumActivePerKey();
137    /**
138     * See {@link GenericKeyedObjectPool#getBorrowedCount()}
139     * @return See {@link GenericKeyedObjectPool#getBorrowedCount()}
140     */
141    long getBorrowedCount();
142    /**
143     * See {@link GenericKeyedObjectPool#getReturnedCount()}
144     * @return See {@link GenericKeyedObjectPool#getReturnedCount()}
145     */
146    long getReturnedCount();
147    /**
148     * See {@link GenericKeyedObjectPool#getCreatedCount()}
149     * @return See {@link GenericKeyedObjectPool#getCreatedCount()}
150     */
151    long getCreatedCount();
152    /**
153     * See {@link GenericKeyedObjectPool#getDestroyedCount()}
154     * @return See {@link GenericKeyedObjectPool#getDestroyedCount()}
155     */
156    long getDestroyedCount();
157    /**
158     * See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
159     * @return See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
160     */
161    long getDestroyedByEvictorCount();
162    /**
163     * See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
164     * @return See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
165     */
166    long getDestroyedByBorrowValidationCount();
167    /**
168     * See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
169     * @return See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
170     */
171    long getMeanActiveTimeMillis();
172    /**
173     * See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
174     * @return See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
175     */
176    long getMeanIdleTimeMillis();
177    /**
178     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
179     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
180     */
181    long getMeanBorrowWaitTimeMillis();
182    /**
183     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
184     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
185     */
186    long getMaxBorrowWaitTimeMillis();
187    /**
188     * See {@link GenericKeyedObjectPool#getCreationStackTrace()}
189     * @return See {@link GenericKeyedObjectPool#getCreationStackTrace()}
190     */
191    String getCreationStackTrace();
192    /**
193     * See {@link GenericKeyedObjectPool#getNumWaiters()}
194     * @return See {@link GenericKeyedObjectPool#getNumWaiters()}
195     */
196    int getNumWaiters();
197    /**
198     * See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
199     * @return See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
200     */
201    Map<String,Integer> getNumWaitersByKey();
202    /**
203     * See {@link GenericKeyedObjectPool#listAllObjects()}
204     * @return See {@link GenericKeyedObjectPool#listAllObjects()}
205     */
206    Map<String,List<DefaultPooledObjectInfo>> listAllObjects();
207}