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 is subject to change between major version releases
026 * of commons pool.
027 *
028 * @param <K> The type of keys maintained by the pool.
029 *
030 * @version $Revision: $
031 *
032 * @since 2.0
033 */
034public interface GenericKeyedObjectPoolMXBean<K> {
035    // Expose getters for configuration settings
036    /**
037     * See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
038     * @return See {@link GenericKeyedObjectPool#getBlockWhenExhausted()}
039     */
040    boolean getBlockWhenExhausted();
041    /**
042     * See {@link GenericKeyedObjectPool#getLifo()}
043     * @return See {@link GenericKeyedObjectPool#getLifo()}
044     */
045    boolean getLifo();
046    /**
047     * See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
048     * @return See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
049     */
050    int getMaxIdlePerKey();
051    /**
052     * See {@link GenericKeyedObjectPool#getMaxTotal()}
053     * @return See {@link GenericKeyedObjectPool#getMaxTotal()}
054     */
055    int getMaxTotal();
056    /**
057     * See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
058     * @return See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
059     */
060    int getMaxTotalPerKey();
061    /**
062     * See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
063     * @return See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
064     */
065    long getMaxWaitMillis();
066    /**
067     * See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
068     * @return See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
069     */
070    long getMinEvictableIdleTimeMillis();
071    /**
072     * See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
073     * @return See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
074     */
075    int getMinIdlePerKey();
076    /**
077     * See {@link GenericKeyedObjectPool#getNumActive()}
078     * @return See {@link GenericKeyedObjectPool#getNumActive()}
079     */
080    int getNumActive();
081    /**
082     * See {@link GenericKeyedObjectPool#getNumIdle()}
083     * @return See {@link GenericKeyedObjectPool#getNumIdle()}
084     */
085    int getNumIdle();
086    /**
087     * See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
088     * @return See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
089     */
090    int getNumTestsPerEvictionRun();
091    /**
092     * See {@link GenericKeyedObjectPool#getTestOnBorrow()}
093     * @return See {@link GenericKeyedObjectPool#getTestOnBorrow()}
094     */
095    boolean getTestOnBorrow();
096    /**
097     * See {@link GenericKeyedObjectPool#getTestOnReturn()}
098     * @return See {@link GenericKeyedObjectPool#getTestOnReturn()}
099     */
100    boolean getTestOnReturn();
101    /**
102     * See {@link GenericKeyedObjectPool#getTestWhileIdle()}
103     * @return See {@link GenericKeyedObjectPool#getTestWhileIdle()}
104     */
105    boolean getTestWhileIdle();
106    /**
107     * See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
108     * @return See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
109     */
110    long getTimeBetweenEvictionRunsMillis();
111    /**
112     * See {@link GenericKeyedObjectPool#isClosed()}
113     * @return See {@link GenericKeyedObjectPool#isClosed()}
114     */
115    boolean isClosed();
116    // Expose getters for monitoring attributes
117    /**
118     * See {@link GenericKeyedObjectPool#getNumActivePerKey()}
119     * @return See {@link GenericKeyedObjectPool#getNumActivePerKey()}
120     */
121    Map<String,Integer> getNumActivePerKey();
122    /**
123     * See {@link GenericKeyedObjectPool#getBorrowedCount()}
124     * @return See {@link GenericKeyedObjectPool#getBorrowedCount()}
125     */
126    long getBorrowedCount();
127    /**
128     * See {@link GenericKeyedObjectPool#getReturnedCount()}
129     * @return See {@link GenericKeyedObjectPool#getReturnedCount()}
130     */
131    long getReturnedCount();
132    /**
133     * See {@link GenericKeyedObjectPool#getCreatedCount()}
134     * @return See {@link GenericKeyedObjectPool#getCreatedCount()}
135     */
136    long getCreatedCount();
137    /**
138     * See {@link GenericKeyedObjectPool#getDestroyedCount()}
139     * @return See {@link GenericKeyedObjectPool#getDestroyedCount()}
140     */
141    long getDestroyedCount();
142    /**
143     * See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
144     * @return See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
145     */
146    long getDestroyedByEvictorCount();
147    /**
148     * See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
149     * @return See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
150     */
151    long getDestroyedByBorrowValidationCount();
152    /**
153     * See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
154     * @return See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
155     */
156    long getMeanActiveTimeMillis();
157    /**
158     * See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
159     * @return See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
160     */
161    long getMeanIdleTimeMillis();
162    /**
163     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
164     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
165     */
166    long getMeanBorrowWaitTimeMillis();
167    /**
168     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
169     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
170     */
171    long getMaxBorrowWaitTimeMillis();
172    /**
173     * See {@link GenericKeyedObjectPool#getCreationStackTrace()}
174     * @return See {@link GenericKeyedObjectPool#getCreationStackTrace()}
175     */
176    String getCreationStackTrace();
177    /**
178     * See {@link GenericKeyedObjectPool#getNumWaiters()}
179     * @return See {@link GenericKeyedObjectPool#getNumWaiters()}
180     */
181    int getNumWaiters();
182    /**
183     * See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
184     * @return See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
185     */
186    Map<String,Integer> getNumWaitersByKey();
187    /**
188     * See {@link GenericKeyedObjectPool#listAllObjects()}
189     * @return See {@link GenericKeyedObjectPool#listAllObjects()}
190     */
191    Map<String,List<DefaultPooledObjectInfo>> listAllObjects();
192}