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 */ 017 018 package org.apache.commons.pool.impl; 019 020 import org.apache.commons.pool.KeyedObjectPool; 021 import org.apache.commons.pool.KeyedObjectPoolFactory; 022 import org.apache.commons.pool.KeyedPoolableObjectFactory; 023 024 /** 025 * A factory for creating {@link GenericKeyedObjectPool} instances. 026 * 027 * @see GenericKeyedObjectPool 028 * @see KeyedObjectPoolFactory 029 * 030 * @author Rodney Waldhoff 031 * @author Dirk Verbeeck 032 * @version $Revision: 965263 $ $Date: 2010-07-18 10:23:39 -0700 (Sun, 18 Jul 2010) $ 033 * @since Pool 1.0 034 */ 035 public class GenericKeyedObjectPoolFactory implements KeyedObjectPoolFactory { 036 /** 037 * Create a new GenericKeyedObjectPoolFactory. 038 * 039 * @param factory the KeyedPoolableObjectFactory to used by created pools. 040 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory) 041 */ 042 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory) { 043 this(factory,GenericKeyedObjectPool.DEFAULT_MAX_ACTIVE,GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,GenericKeyedObjectPool.DEFAULT_MAX_WAIT,GenericKeyedObjectPool.DEFAULT_MAX_IDLE,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 044 } 045 046 /** 047 * Create a new GenericKeyedObjectPoolFactory. 048 * 049 * @param factory the KeyedPoolableObjectFactory to used by created pools. 050 * @param config a non-null GenericKeyedObjectPool.Config describing the configuration. 051 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, GenericKeyedObjectPool.Config) 052 * @throws NullPointerException when config is <code>null</code>. 053 */ 054 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, GenericKeyedObjectPool.Config config) throws NullPointerException { 055 this(factory,config.maxActive,config.whenExhaustedAction,config.maxWait,config.maxIdle,config.maxTotal,config.minIdle,config.testOnBorrow,config.testOnReturn,config.timeBetweenEvictionRunsMillis,config.numTestsPerEvictionRun,config.minEvictableIdleTimeMillis,config.testWhileIdle,config.lifo); 056 } 057 058 /** 059 * Create a new GenericKeyedObjectPoolFactory. 060 * 061 * @param factory the KeyedPoolableObjectFactory to used by created pools. 062 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 063 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int) 064 */ 065 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive) { 066 this(factory,maxActive,GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,GenericKeyedObjectPool.DEFAULT_MAX_WAIT,GenericKeyedObjectPool.DEFAULT_MAX_IDLE, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 067 } 068 069 /** 070 * Create a new GenericKeyedObjectPoolFactory. 071 * 072 * @param factory the KeyedPoolableObjectFactory to used by created pools. 073 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 074 * @param whenExhaustedAction the action to take when the pool is exhausted. 075 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 076 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long) 077 */ 078 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait) { 079 this(factory,maxActive,whenExhaustedAction,maxWait,GenericKeyedObjectPool.DEFAULT_MAX_IDLE, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 080 } 081 082 /** 083 * Create a new GenericKeyedObjectPoolFactory. 084 * 085 * @param factory the KeyedPoolableObjectFactory to used by created pools. 086 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 087 * @param whenExhaustedAction the action to take when the pool is exhausted. 088 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 089 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 090 * @param testOnReturn whether to validate objects after they are returned to returnObject. 091 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, boolean, boolean) 092 */ 093 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) { 094 this(factory,maxActive,whenExhaustedAction,maxWait,GenericKeyedObjectPool.DEFAULT_MAX_IDLE, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,testOnBorrow,testOnReturn,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 095 } 096 097 /** 098 * Create a new GenericKeyedObjectPoolFactory. 099 * 100 * @param factory the KeyedPoolableObjectFactory to used by created pools. 101 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 102 * @param whenExhaustedAction the action to take when the pool is exhausted. 103 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 104 * @param maxIdle the maximum number of idle objects in the pools. 105 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int) 106 */ 107 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) { 108 this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 109 } 110 111 /** 112 * Create a new GenericKeyedObjectPoolFactory. 113 * 114 * @param factory the KeyedPoolableObjectFactory to used by created pools. 115 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 116 * @param whenExhaustedAction the action to take when the pool is exhausted. 117 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 118 * @param maxIdle the maximum number of idle objects in the pools. 119 * @param maxTotal the maximum number of objects that can exists at one time. 120 */ 121 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal) { 122 this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, maxTotal, GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 123 } 124 125 /** 126 * Create a new GenericKeyedObjectPoolFactory. 127 * 128 * @param factory the KeyedPoolableObjectFactory to used by created pools. 129 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 130 * @param whenExhaustedAction the action to take when the pool is exhausted. 131 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 132 * @param maxIdle the maximum number of idle objects in the pools. 133 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 134 * @param testOnReturn whether to validate objects after they are returned to returnObject. 135 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean) 136 */ 137 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) { 138 this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,testOnBorrow,testOnReturn,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE); 139 } 140 141 /** 142 * Create a new GenericKeyedObjectPoolFactory. 143 * 144 * @param factory the KeyedPoolableObjectFactory to used by created pools. 145 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 146 * @param whenExhaustedAction the action to take when the pool is exhausted. 147 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 148 * @param maxIdle the maximum number of idle objects in the pools. 149 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 150 * @param testOnReturn whether to validate objects after they are returned to returnObject. 151 * @param timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction. 152 * @param numTestsPerEvictionRun the number of idle objects to examine per run of the evictor. 153 * @param minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction. 154 * @param testWhileIdle whether to validate objects in the idle object eviction thread. 155 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean, long, int, long, boolean) 156 */ 157 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) { 158 this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL, testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle); 159 } 160 161 /** 162 * Create a new GenericKeyedObjectPoolFactory. 163 * 164 * @param factory the KeyedPoolableObjectFactory to used by created pools. 165 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 166 * @param whenExhaustedAction the action to take when the pool is exhausted. 167 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 168 * @param maxIdle the maximum number of idle objects in the pools. 169 * @param maxTotal the maximum number of objects that can exists at one time. 170 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 171 * @param testOnReturn whether to validate objects after they are returned to returnObject. 172 * @param timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction. 173 * @param numTestsPerEvictionRun the number of idle objects to examine per run of the evictor. 174 * @param minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction. 175 * @param testWhileIdle whether to validate objects in the idle object eviction thread. 176 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean) 177 */ 178 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) { 179 this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, maxTotal, GenericKeyedObjectPool.DEFAULT_MIN_IDLE , testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle); 180 } 181 182 /** 183 * Create a new GenericKeyedObjectPoolFactory. 184 * 185 * @param factory the KeyedPoolableObjectFactory to used by created pools. 186 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 187 * @param whenExhaustedAction the action to take when the pool is exhausted. 188 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 189 * @param maxIdle the maximum number of idle objects in the pools. 190 * @param maxTotal the maximum number of objects that can exists at one time. 191 * @param minIdle the minimum number of idle objects to have in the pool at any one time. 192 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 193 * @param testOnReturn whether to validate objects after they are returned to returnObject. 194 * @param timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction. 195 * @param numTestsPerEvictionRun the number of idle objects to examine per run of the evictor. 196 * @param minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction. 197 * @param testWhileIdle whether to validate objects in the idle object eviction thread. 198 * @since Pool 1.3 199 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean) 200 */ 201 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) { 202 this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, maxTotal, minIdle, testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle, GenericKeyedObjectPool.DEFAULT_LIFO); 203 } 204 205 /** 206 * Create a new GenericKeyedObjectPoolFactory. 207 * 208 * @param factory the KeyedPoolableObjectFactory to used by created pools. 209 * @param maxActive the maximum number of objects that can be borrowed from pools at one time. 210 * @param whenExhaustedAction the action to take when the pool is exhausted. 211 * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted. 212 * @param maxIdle the maximum number of idle objects in the pools. 213 * @param maxTotal the maximum number of objects that can exists at one time. 214 * @param minIdle the minimum number of idle objects to have in the pool at any one time. 215 * @param testOnBorrow whether to validate objects before they are returned by borrowObject. 216 * @param testOnReturn whether to validate objects after they are returned to returnObject. 217 * @param timeBetweenEvictionRunsMillis the number of milliseconds to sleep between examining idle objects for eviction. 218 * @param numTestsPerEvictionRun the number of idle objects to examine per run of the evictor. 219 * @param minEvictableIdleTimeMillis the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction. 220 * @param testWhileIdle whether to validate objects in the idle object eviction thread. 221 * @param lifo whether or not objects are returned in last-in-first-out order from the idle object pool. 222 * @since Pool 1.4 223 * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean, boolean) 224 */ 225 public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, boolean lifo) { 226 _maxIdle = maxIdle; 227 _maxActive = maxActive; 228 _maxTotal = maxTotal; 229 _minIdle = minIdle; 230 _maxWait = maxWait; 231 _whenExhaustedAction = whenExhaustedAction; 232 _testOnBorrow = testOnBorrow; 233 _testOnReturn = testOnReturn; 234 _testWhileIdle = testWhileIdle; 235 _timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; 236 _numTestsPerEvictionRun = numTestsPerEvictionRun; 237 _minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; 238 _factory = factory; 239 _lifo = lifo; 240 } 241 242 /** 243 * Create a new GenericKeyedObjectPool with the currently configured properties. 244 * 245 * @return GenericKeyedObjectPool with {@link GenericKeyedObjectPool.Config Configuration} determined by 246 * current property settings 247 */ 248 public KeyedObjectPool createPool() { 249 return new GenericKeyedObjectPool(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_maxTotal,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_lifo); 250 } 251 252 /** 253 * @return the {@link GenericKeyedObjectPool#getMaxIdle() maxIdle} setting for pools created by this factory. 254 * @since 1.5.5 255 */ 256 public int getMaxIdle() { 257 return _maxIdle; 258 } 259 260 /** 261 * @return the {@link GenericKeyedObjectPool#getMaxActive() maxActive} setting for pools created by this factory. 262 * @since 1.5.5 263 */ 264 public int getMaxActive() { 265 return _maxActive; 266 } 267 268 /** 269 * @return the {@link GenericKeyedObjectPool#getMaxTotal() maxTotal} setting for pools created by this factory. 270 * @since 1.5.5 271 */ 272 public int getMaxTotal() { 273 return _maxTotal; 274 } 275 276 /** 277 * @return the {@link GenericKeyedObjectPool#getMinIdle() minIdle} setting for pools created by this factory. 278 * @since 1.5.5 279 */ 280 public int getMinIdle() { 281 return _minIdle; 282 } 283 284 /** 285 * @return the {@link GenericKeyedObjectPool#getMaxWait() maxWait} setting for pools created by this factory. 286 * @since 1.5.5 287 */ 288 public long getMaxWait() { 289 return _maxWait; 290 } 291 292 /** 293 * @return the {@link GenericKeyedObjectPool#getWhenExhaustedAction() whenExhaustedAction} setting for pools created by this factory. 294 * @since 1.5.5 295 */ 296 public byte getWhenExhaustedAction() { 297 return _whenExhaustedAction; 298 } 299 300 /** 301 * @return the {@link GenericKeyedObjectPool#getTestOnBorrow() testOnBorrow} setting for pools created by this factory. 302 * @since 1.5.5 303 */ 304 public boolean getTestOnBorrow() { 305 return _testOnBorrow; 306 } 307 308 /** 309 * @return the {@link GenericKeyedObjectPool#getTestOnReturn() testOnReturn} setting for pools created by this factory. 310 * @since 1.5.5 311 */ 312 public boolean getTestOnReturn() { 313 return _testOnReturn; 314 } 315 316 /** 317 * @return the {@link GenericKeyedObjectPool#getTestWhileIdle() testWhileIdle} setting for pools created by this factory. 318 * @since 1.5.5 319 */ 320 public boolean getTestWhileIdle() { 321 return _testWhileIdle; 322 } 323 324 /** 325 * @return the {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis() timeBetweenEvictionRunsMillis} 326 * setting for pools created by this factory. 327 * @since 1.5.5 328 */ 329 public long getTimeBetweenEvictionRunsMillis() { 330 return _timeBetweenEvictionRunsMillis; 331 } 332 333 /** 334 * @return the {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun() numTestsPerEvictionRun} 335 * setting for pools created by this factory. 336 * @since 1.5.5 337 */ 338 public int getNumTestsPerEvictionRun() { 339 return _numTestsPerEvictionRun; 340 } 341 342 /** 343 * @return the {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis() minEvictableIdleTimeMillis} 344 * setting for pools created by this factory. 345 * @since 1.5.5 346 */ 347 public long getMinEvictableIdleTimeMillis() { 348 return _minEvictableIdleTimeMillis; 349 } 350 351 /** 352 * @return the {@link KeyedPoolableObjectFactory} used by pools created by this factory. 353 * @since 1.5.5 354 */ 355 public KeyedPoolableObjectFactory getFactory() { 356 return _factory; 357 } 358 359 /** 360 * @return the {@link GenericKeyedObjectPool#getLifo() lifo} setting for pools created by this factory. 361 * @since 1.5.5 362 */ 363 public boolean getLifo() { 364 return _lifo; 365 } 366 367 //--- protected attributes - deprecated, use getters to access these properties 368 369 /** 370 * The {@link GenericKeyedObjectPool#getMaxIdle() maxIdle} setting for pools created by this factory. 371 * @deprecated to be removed in pool 2.0. Use {@link #getMaxIdle()}. 372 */ 373 protected int _maxIdle = GenericKeyedObjectPool.DEFAULT_MAX_IDLE; 374 375 /** 376 * The {@link GenericKeyedObjectPool#getMaxActive() maxActive} setting for pools created by this factory. 377 * @deprecated to be removed in pool 2.0. Use {@link #getMaxActive()}. 378 */ 379 protected int _maxActive = GenericKeyedObjectPool.DEFAULT_MAX_ACTIVE; 380 381 /** 382 * The {@link GenericKeyedObjectPool#getMaxTotal() maxTotal} setting for pools created by this factory. 383 * @deprecated to be removed in pool 2.0. Use {@link #getMaxTotal()}. 384 */ 385 protected int _maxTotal = GenericKeyedObjectPool.DEFAULT_MAX_TOTAL; 386 387 /** 388 * The {@link GenericKeyedObjectPool#getMinIdle() minIdle} setting for pools created by this factory. 389 * @deprecated to be removed in pool 2.0. Use {@link #getMinIdle()}. 390 */ 391 protected int _minIdle = GenericKeyedObjectPool.DEFAULT_MIN_IDLE; 392 393 /** 394 * The {@link GenericKeyedObjectPool#getMaxWait() maxWait} setting for pools created by this factory. 395 * @deprecated to be removed in pool 2.0. Use {@link #getMaxWait()}. 396 */ 397 protected long _maxWait = GenericKeyedObjectPool.DEFAULT_MAX_WAIT; 398 399 /** 400 * The {@link GenericKeyedObjectPool#getWhenExhaustedAction() whenExhaustedAction} setting for pools created by this factory. 401 * @deprecated to be removed in pool 2.0. Use {@link #getWhenExhaustedAction()}. 402 */ 403 protected byte _whenExhaustedAction = GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION; 404 405 /** 406 * The {@link GenericKeyedObjectPool#getTestOnBorrow() testOnBorrow} setting for pools created by this factory. 407 * @deprecated to be removed in pool 2.0. Use {@link #getTestOnBorrow()}. 408 */ 409 protected boolean _testOnBorrow = GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW; 410 411 /** 412 * The {@link GenericKeyedObjectPool#getTestOnReturn() testOnReturn} setting for pools created by this factory. 413 * @deprecated to be removed in pool 2.0. Use {@link #getTestOnReturn()}. 414 */ 415 protected boolean _testOnReturn = GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN; 416 417 /** 418 * The {@link GenericKeyedObjectPool#getTestWhileIdle() testWhileIdle} setting for pools created by this factory. 419 * @deprecated to be removed in pool 2.0. Use {@link #getTestWhileIdle()}. 420 */ 421 protected boolean _testWhileIdle = GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE; 422 423 /** 424 * The {@link GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis() timeBetweenEvictionRunsMillis} setting for 425 * pools created by this factory. 426 * @deprecated to be removed in pool 2.0. Use {@link #getTimeBetweenEvictionRunsMillis()}. 427 */ 428 protected long _timeBetweenEvictionRunsMillis = GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS; 429 430 /** 431 * The {@link GenericKeyedObjectPool#getNumTestsPerEvictionRun() numTestsPerEvictionRun} setting for 432 * pools created by this factory. 433 * @deprecated to be removed in pool 2.0. Use {@link #getNumTestsPerEvictionRun()}. 434 */ 435 protected int _numTestsPerEvictionRun = GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN; 436 437 /** 438 * The {@link GenericKeyedObjectPool#getMinEvictableIdleTimeMillis() minEvictableIdleTimeMillis} setting for 439 * pools created by this factory. 440 * @deprecated to be removed in pool 2.0. Use {@link #getMinEvictableIdleTimeMillis()}. 441 */ 442 protected long _minEvictableIdleTimeMillis = GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS; 443 444 /** 445 * The {@link KeyedPoolableObjectFactory} used by pools created by this factory. 446 * @deprecated to be removed in pool 2.0. Use {@link #getFactory()}. 447 */ 448 protected KeyedPoolableObjectFactory _factory = null; 449 450 /** 451 * The {@link GenericKeyedObjectPool#getLifo() lifo} setting for pools created by this factory. 452 * @deprecated to be removed in pool 2.0. Use {@link #getLifo()}. 453 */ 454 protected boolean _lifo = GenericKeyedObjectPool.DEFAULT_LIFO; 455 456 }