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