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