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#getLifo()}
047     * @return See {@link GenericKeyedObjectPool#getLifo()}
048     */
049    boolean getLifo();
050    /**
051     * See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
052     * @return See {@link GenericKeyedObjectPool#getMaxIdlePerKey()}
053     */
054    int getMaxIdlePerKey();
055    /**
056     * See {@link GenericKeyedObjectPool#getMaxTotal()}
057     * @return See {@link GenericKeyedObjectPool#getMaxTotal()}
058     */
059    int getMaxTotal();
060    /**
061     * See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
062     * @return See {@link GenericKeyedObjectPool#getMaxTotalPerKey()}
063     */
064    int getMaxTotalPerKey();
065    /**
066     * See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
067     * @return See {@link GenericKeyedObjectPool#getMaxWaitMillis()}
068     */
069    long getMaxWaitMillis();
070    /**
071     * See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
072     * @return See {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis()}
073     */
074    long getMinEvictableIdleTimeMillis();
075    /**
076     * See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
077     * @return See {@link GenericKeyedObjectPool#getMinIdlePerKey()}
078     */
079    int getMinIdlePerKey();
080    /**
081     * See {@link GenericKeyedObjectPool#getNumActive()}
082     * @return See {@link GenericKeyedObjectPool#getNumActive()}
083     */
084    int getNumActive();
085    /**
086     * See {@link GenericKeyedObjectPool#getNumIdle()}
087     * @return See {@link GenericKeyedObjectPool#getNumIdle()}
088     */
089    int getNumIdle();
090    /**
091     * See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
092     * @return See {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun()}
093     */
094    int getNumTestsPerEvictionRun();
095    /**
096     * See {@link GenericKeyedObjectPool#getTestOnCreate()}
097     * @return See {@link GenericKeyedObjectPool#getTestOnCreate()}
098     * @since 2.2
099     */
100    boolean getTestOnCreate();
101    /**
102     * See {@link GenericKeyedObjectPool#getTestOnBorrow()}
103     * @return See {@link GenericKeyedObjectPool#getTestOnBorrow()}
104     */
105    boolean getTestOnBorrow();
106    /**
107     * See {@link GenericKeyedObjectPool#getTestOnReturn()}
108     * @return See {@link GenericKeyedObjectPool#getTestOnReturn()}
109     */
110    boolean getTestOnReturn();
111    /**
112     * See {@link GenericKeyedObjectPool#getTestWhileIdle()}
113     * @return See {@link GenericKeyedObjectPool#getTestWhileIdle()}
114     */
115    boolean getTestWhileIdle();
116    /**
117     * See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
118     * @return See {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis()}
119     */
120    long getTimeBetweenEvictionRunsMillis();
121    /**
122     * See {@link GenericKeyedObjectPool#isClosed()}
123     * @return See {@link GenericKeyedObjectPool#isClosed()}
124     */
125    boolean isClosed();
126    // Expose getters for monitoring attributes
127    /**
128     * See {@link GenericKeyedObjectPool#getNumActivePerKey()}
129     * @return See {@link GenericKeyedObjectPool#getNumActivePerKey()}
130     */
131    Map<String,Integer> getNumActivePerKey();
132    /**
133     * See {@link GenericKeyedObjectPool#getBorrowedCount()}
134     * @return See {@link GenericKeyedObjectPool#getBorrowedCount()}
135     */
136    long getBorrowedCount();
137    /**
138     * See {@link GenericKeyedObjectPool#getReturnedCount()}
139     * @return See {@link GenericKeyedObjectPool#getReturnedCount()}
140     */
141    long getReturnedCount();
142    /**
143     * See {@link GenericKeyedObjectPool#getCreatedCount()}
144     * @return See {@link GenericKeyedObjectPool#getCreatedCount()}
145     */
146    long getCreatedCount();
147    /**
148     * See {@link GenericKeyedObjectPool#getDestroyedCount()}
149     * @return See {@link GenericKeyedObjectPool#getDestroyedCount()}
150     */
151    long getDestroyedCount();
152    /**
153     * See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
154     * @return See {@link GenericKeyedObjectPool#getDestroyedByEvictorCount()}
155     */
156    long getDestroyedByEvictorCount();
157    /**
158     * See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
159     * @return See {@link GenericKeyedObjectPool#getDestroyedByBorrowValidationCount()}
160     */
161    long getDestroyedByBorrowValidationCount();
162    /**
163     * See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
164     * @return See {@link GenericKeyedObjectPool#getMeanActiveTimeMillis()}
165     */
166    long getMeanActiveTimeMillis();
167    /**
168     * See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
169     * @return See {@link GenericKeyedObjectPool#getMeanIdleTimeMillis()}
170     */
171    long getMeanIdleTimeMillis();
172    /**
173     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
174     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
175     */
176    long getMeanBorrowWaitTimeMillis();
177    /**
178     * See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
179     * @return See {@link GenericKeyedObjectPool#getMaxBorrowWaitTimeMillis()}
180     */
181    long getMaxBorrowWaitTimeMillis();
182    /**
183     * See {@link GenericKeyedObjectPool#getCreationStackTrace()}
184     * @return See {@link GenericKeyedObjectPool#getCreationStackTrace()}
185     */
186    String getCreationStackTrace();
187    /**
188     * See {@link GenericKeyedObjectPool#getNumWaiters()}
189     * @return See {@link GenericKeyedObjectPool#getNumWaiters()}
190     */
191    int getNumWaiters();
192    /**
193     * See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
194     * @return See {@link GenericKeyedObjectPool#getNumWaitersByKey()}
195     */
196    Map<String,Integer> getNumWaitersByKey();
197    /**
198     * See {@link GenericKeyedObjectPool#listAllObjects()}
199     * @return See {@link GenericKeyedObjectPool#listAllObjects()}
200     */
201    Map<String,List<DefaultPooledObjectInfo>> listAllObjects();
202}