org.apache.commons.pool.impl
Class GenericKeyedObjectPoolFactory

java.lang.Object
  extended by org.apache.commons.pool.impl.GenericKeyedObjectPoolFactory
All Implemented Interfaces:
KeyedObjectPoolFactory

public class GenericKeyedObjectPoolFactory
extends Object
implements KeyedObjectPoolFactory

A factory for creating GenericKeyedObjectPool instances.

Since:
Pool 1.0
Version:
$Revision: 777748 $ $Date: 2009-05-22 20:00:44 -0400 (Fri, 22 May 2009) $
Author:
Rodney Waldhoff, Dirk Verbeeck
See Also:
GenericKeyedObjectPool, KeyedObjectPoolFactory

Field Summary
protected  KeyedPoolableObjectFactory _factory
           
protected  boolean _lifo
           
protected  int _maxActive
           
protected  int _maxIdle
           
protected  int _maxTotal
           
protected  long _maxWait
           
protected  long _minEvictableIdleTimeMillis
           
protected  int _minIdle
           
protected  int _numTestsPerEvictionRun
           
protected  boolean _testOnBorrow
           
protected  boolean _testOnReturn
           
protected  boolean _testWhileIdle
           
protected  long _timeBetweenEvictionRunsMillis
           
protected  byte _whenExhaustedAction
           
 
Constructor Summary
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, GenericKeyedObjectPool.Config config)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle)
          Create a new GenericKeyedObjectPoolFactory.
GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal)
          Create a new GenericKeyedObjectPoolFactory.
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)
          Create a new GenericKeyedObjectPoolFactory.
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)
          Create a new GenericKeyedObjectPoolFactory.
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)
          Create a new GenericKeyedObjectPoolFactory.
 
Method Summary
 KeyedObjectPool createPool()
          Create a new KeyedObjectPool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_maxIdle

protected int _maxIdle

_maxActive

protected int _maxActive

_maxTotal

protected int _maxTotal

_minIdle

protected int _minIdle

_maxWait

protected long _maxWait

_whenExhaustedAction

protected byte _whenExhaustedAction

_testOnBorrow

protected boolean _testOnBorrow

_testOnReturn

protected boolean _testOnReturn

_testWhileIdle

protected boolean _testWhileIdle

_timeBetweenEvictionRunsMillis

protected long _timeBetweenEvictionRunsMillis

_numTestsPerEvictionRun

protected int _numTestsPerEvictionRun

_minEvictableIdleTimeMillis

protected long _minEvictableIdleTimeMillis

_factory

protected KeyedPoolableObjectFactory _factory

_lifo

protected boolean _lifo
Constructor Detail

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     GenericKeyedObjectPool.Config config)
                              throws NullPointerException
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
config - a non-null GenericKeyedObjectPool.Config describing the configuration.
Throws:
NullPointerException - when config is null.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, GenericKeyedObjectPool.Config)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait,
                                     boolean testOnBorrow,
                                     boolean testOnReturn)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, boolean, boolean)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait,
                                     int maxIdle)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait,
                                     int maxIdle,
                                     int maxTotal)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
maxTotal - the maximum number of objects that can exists at one time.

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait,
                                     int maxIdle,
                                     boolean testOnBorrow,
                                     boolean testOnReturn)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean)

GenericKeyedObjectPoolFactory

public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory factory,
                                     int maxActive,
                                     byte whenExhaustedAction,
                                     long maxWait,
                                     int maxIdle,
                                     boolean testOnBorrow,
                                     boolean testOnReturn,
                                     long timeBetweenEvictionRunsMillis,
                                     int numTestsPerEvictionRun,
                                     long minEvictableIdleTimeMillis,
                                     boolean testWhileIdle)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis - the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun - the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle - whether to validate objects in the idle object eviction thread.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean, long, int, long, boolean)

GenericKeyedObjectPoolFactory

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)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
maxTotal - the maximum number of objects that can exists at one time.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis - the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun - the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle - whether to validate objects in the idle object eviction thread.
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean)

GenericKeyedObjectPoolFactory

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)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
maxTotal - the maximum number of objects that can exists at one time.
minIdle - the minimum number of idle objects to have in the pool at any one time.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis - the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun - the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle - whether to validate objects in the idle object eviction thread.
Since:
Pool 1.3
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean)

GenericKeyedObjectPoolFactory

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)
Create a new GenericKeyedObjectPoolFactory.

Parameters:
factory - the KeyedPoolableObjectFactory to used by created pools.
maxActive - the maximum number of objects that can be borrowed from pools at one time.
whenExhaustedAction - the action to take when the pool is exhausted.
maxWait - the maximum amount of time to wait for an idle object when the pool is exhausted.
maxIdle - the maximum number of idle objects in the pools.
maxTotal - the maximum number of objects that can exists at one time.
minIdle - the minimum number of idle objects to have in the pool at any one time.
testOnBorrow - whether to validate objects before they are returned by borrowObject.
testOnReturn - whether to validate objects after they are returned to returnObject.
timeBetweenEvictionRunsMillis - the number of milliseconds to sleep between examining idle objects for eviction.
numTestsPerEvictionRun - the number of idle objects to examine per run of the evictor.
minEvictableIdleTimeMillis - the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.
testWhileIdle - whether to validate objects in the idle object eviction thread.
lifo - whether or not objects are returned in last-in-first-out order from the idle object pool.
Since:
Pool 1.4
See Also:
GenericKeyedObjectPool.GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean, boolean)
Method Detail

createPool

public KeyedObjectPool createPool()
Description copied from interface: KeyedObjectPoolFactory
Create a new KeyedObjectPool.

Specified by:
createPool in interface KeyedObjectPoolFactory
Returns:
a new KeyedObjectPool


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.