1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.pool2.impl; 18 19 import java.util.Set; 20 21 /** 22 * Defines the methods that will be made available via JMX. 23 * <h2>Note</h2> 24 * <p> 25 * This interface exists only to define those attributes and methods that will be made available via JMX. It must not be implemented by clients as it is subject 26 * to change between major, minor and patch version releases of commons pool. Clients that implement this interface may not, therefore, be able to upgrade to a 27 * new minor or patch release without requiring code changes. 28 * </p> 29 * 30 * @since 2.0 31 */ 32 public interface GenericObjectPoolMXBean { 33 34 /** 35 * See {@link GenericObjectPool#getBlockWhenExhausted()}. 36 * 37 * @return See {@link GenericObjectPool#getBlockWhenExhausted()}. 38 */ 39 boolean getBlockWhenExhausted(); 40 41 /** 42 * See {@link GenericObjectPool#getBorrowedCount()}. 43 * 44 * @return See {@link GenericObjectPool#getBorrowedCount()}. 45 */ 46 long getBorrowedCount(); 47 48 /** 49 * See {@link GenericObjectPool#getCreatedCount()}. 50 * 51 * @return See {@link GenericObjectPool#getCreatedCount()}. 52 */ 53 long getCreatedCount(); 54 55 /** 56 * See {@link GenericObjectPool#getCreationStackTrace()}. 57 * 58 * @return See {@link GenericObjectPool#getCreationStackTrace()}. 59 */ 60 String getCreationStackTrace(); 61 62 /** 63 * See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}. 64 * 65 * @return See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}. 66 */ 67 long getDestroyedByBorrowValidationCount(); 68 69 /** 70 * See {@link GenericObjectPool#getDestroyedByEvictorCount()}. 71 * 72 * @return See {@link GenericObjectPool#getDestroyedByEvictorCount()}. 73 */ 74 long getDestroyedByEvictorCount(); 75 76 /** 77 * See {@link GenericObjectPool#getDestroyedCount()}. 78 * 79 * @return See {@link GenericObjectPool#getDestroyedCount()}. 80 */ 81 long getDestroyedCount(); 82 83 /** 84 * See {@link GenericObjectPool#getFactoryType()}. 85 * 86 * @return See {@link GenericObjectPool#getFactoryType()}. 87 */ 88 String getFactoryType(); 89 90 /** 91 * See {@link GenericObjectPool#getLifo()}. 92 * 93 * @return See {@link GenericObjectPool#getLifo()}. 94 */ 95 boolean getFairness(); 96 97 /** 98 * See {@link GenericObjectPool#getFairness()}. 99 * 100 * @return See {@link GenericObjectPool#getFairness()}. 101 */ 102 boolean getLifo(); 103 104 /** 105 * See {@link GenericObjectPool#getLogAbandoned()}. 106 * 107 * @return See {@link GenericObjectPool#getLogAbandoned()}. 108 */ 109 boolean getLogAbandoned(); 110 111 /** 112 * See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}. 113 * 114 * @return See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}. 115 */ 116 long getMaxBorrowWaitTimeMillis(); 117 118 /** 119 * See {@link GenericObjectPool#getMaxIdle()}. 120 * 121 * @return See {@link GenericObjectPool#getMaxIdle()}. 122 */ 123 int getMaxIdle(); 124 125 /** 126 * See {@link GenericObjectPool#getMaxTotal()}. 127 * 128 * @return See {@link GenericObjectPool#getMaxTotal()}. 129 */ 130 int getMaxTotal(); 131 132 /** 133 * See {@link GenericObjectPool#getMaxWaitDuration()}. 134 * 135 * @return See {@link GenericObjectPool#getMaxWaitDuration()}. 136 */ 137 long getMaxWaitMillis(); 138 139 /** 140 * See {@link GenericObjectPool#getMeanActiveTimeMillis()}. 141 * 142 * @return See {@link GenericObjectPool#getMeanActiveTimeMillis()}. 143 */ 144 long getMeanActiveTimeMillis(); 145 146 /** 147 * See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}. 148 * 149 * @return See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}. 150 */ 151 long getMeanBorrowWaitTimeMillis(); 152 153 // Getters for monitoring attributes 154 155 /** 156 * See {@link GenericObjectPool#getMeanIdleTimeMillis()}. 157 * 158 * @return See {@link GenericObjectPool#getMeanIdleTimeMillis()}. 159 */ 160 long getMeanIdleTimeMillis(); 161 162 /** 163 * See {@link GenericObjectPool#getMinEvictableIdleDuration()}. 164 * 165 * @return See {@link GenericObjectPool#getMinEvictableIdleDuration()}. 166 */ 167 long getMinEvictableIdleTimeMillis(); 168 169 /** 170 * See {@link GenericObjectPool#getMinIdle()}. 171 * 172 * @return See {@link GenericObjectPool#getMinIdle()}. 173 */ 174 int getMinIdle(); 175 176 /** 177 * See {@link GenericObjectPool#getNumActive()}. 178 * 179 * @return See {@link GenericObjectPool#getNumActive()}. 180 */ 181 int getNumActive(); 182 183 /** 184 * See {@link GenericObjectPool#getNumIdle()}. 185 * 186 * @return See {@link GenericObjectPool#getNumIdle()}. 187 */ 188 int getNumIdle(); 189 190 /** 191 * See {@link GenericObjectPool#getNumTestsPerEvictionRun()}. 192 * 193 * @return See {@link GenericObjectPool#getNumTestsPerEvictionRun()}. 194 */ 195 int getNumTestsPerEvictionRun(); 196 197 /** 198 * See {@link GenericObjectPool#getNumWaiters()}. 199 * 200 * @return See {@link GenericObjectPool#getNumWaiters()}. 201 */ 202 int getNumWaiters(); 203 204 /** 205 * See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}. 206 * 207 * @return See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}. 208 */ 209 boolean getRemoveAbandonedOnBorrow(); 210 211 /** 212 * See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}. 213 * 214 * @return See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}. 215 */ 216 boolean getRemoveAbandonedOnMaintenance(); 217 218 /** 219 * See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}. 220 * 221 * @return See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}. 222 */ 223 int getRemoveAbandonedTimeout(); 224 225 /** 226 * See {@link GenericObjectPool#getReturnedCount()}. 227 * 228 * @return See {@link GenericObjectPool#getReturnedCount()}. 229 */ 230 long getReturnedCount(); 231 232 /** 233 * See {@link GenericObjectPool#getTestOnBorrow()}. 234 * 235 * @return See {@link GenericObjectPool#getTestOnBorrow()}. 236 */ 237 boolean getTestOnBorrow(); 238 239 // Getters for abandoned object removal configuration 240 241 /** 242 * See {@link GenericObjectPool#getTestOnCreate()}. 243 * 244 * @return See {@link GenericObjectPool#getTestOnCreate()}. 245 * @since 2.2 246 */ 247 boolean getTestOnCreate(); 248 249 /** 250 * See {@link GenericObjectPool#getTestOnReturn()}. 251 * 252 * @return See {@link GenericObjectPool#getTestOnReturn()}. 253 */ 254 boolean getTestOnReturn(); 255 256 /** 257 * See {@link GenericObjectPool#getTestWhileIdle()}. 258 * 259 * @return See {@link GenericObjectPool#getTestWhileIdle()}. 260 */ 261 boolean getTestWhileIdle(); 262 263 /** 264 * See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}. 265 * 266 * @return See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}. 267 */ 268 long getTimeBetweenEvictionRunsMillis(); 269 270 /** 271 * See {@link GenericObjectPool#isAbandonedConfig()}. 272 * 273 * @return See {@link GenericObjectPool#isAbandonedConfig()}. 274 */ 275 boolean isAbandonedConfig(); 276 277 /** 278 * See {@link GenericObjectPool#isClosed()}. 279 * 280 * @return See {@link GenericObjectPool#isClosed()}. 281 */ 282 boolean isClosed(); 283 284 /** 285 * See {@link GenericObjectPool#listAllObjects()}. 286 * 287 * @return See {@link GenericObjectPool#listAllObjects()}. 288 */ 289 Set<DefaultPooledObjectInfo> listAllObjects(); 290 }