Package org.apache.commons.pool.impl
Class GenericObjectPoolFactory<T>
java.lang.Object
org.apache.commons.pool.impl.GenericObjectPoolFactory<T>
- Type Parameters:
T- the type of objects held in this pool
- All Implemented Interfaces:
ObjectPoolFactory<T>
A factory for creating
GenericObjectPool instances.- Since:
- Pool 1.0
- Version:
- $Revision: 1222396 $ $Date: 2011-12-22 14:02:25 -0500 (Thu, 22 Dec 2011) $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PoolableObjectFactory<T> Deprecated.to be removed in pool 2.0.protected booleanDeprecated.to be removed in pool 2.0.protected intDeprecated.to be removed in pool 2.0.protected intDeprecated.to be removed in pool 2.0.protected longDeprecated.to be removed in pool 2.0.protected longDeprecated.to be removed in pool 2.0.protected intDeprecated.to be removed in pool 2.0.protected intDeprecated.to be removed in pool 2.0.protected longDeprecated.to be removed in pool 2.0.protected booleanDeprecated.to be removed in pool 2.0.protected booleanDeprecated.to be removed in pool 2.0.protected booleanDeprecated.to be removed in pool 2.0.protected longDeprecated.to be removed in pool 2.0.protected byteDeprecated.to be removed in pool 2.0. -
Constructor Summary
ConstructorsConstructorDescriptionGenericObjectPoolFactory(PoolableObjectFactory<T> factory) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis, boolean lifo) Create a new GenericObjectPoolFactory.GenericObjectPoolFactory(PoolableObjectFactory<T> factory, GenericObjectPool.Config config) Create a new GenericObjectPoolFactory. -
Method Summary
Modifier and TypeMethodDescriptionCreate and return a newObjectPool.booleangetLifo()intintlonglongintintlongbooleanbooleanbooleanlongbyte
-
Field Details
-
_maxIdle
Deprecated.to be removed in pool 2.0. UsegetMaxIdle().ThemaxIdlesetting for pools created by this factory. -
_minIdle
Deprecated.to be removed in pool 2.0. UsegetMinIdle().TheminIdlesetting for pools created by this factory. -
_maxActive
Deprecated.to be removed in pool 2.0. UsegetMaxActive().ThemaxActivesetting for pools created by this factory. -
_maxWait
Deprecated.to be removed in pool 2.0. UsegetMaxWait().ThemaxWaitsetting for pools created by this factory. -
_whenExhaustedAction
Deprecated.to be removed in pool 2.0. UsegetWhenExhaustedAction().ThewhenExhaustedActionsetting for pools created by this factory. -
_testOnBorrow
Deprecated.to be removed in pool 2.0. UsegetTestOnBorrow().ThetestOnBorrowsetting for pools created by this factory. -
_testOnReturn
Deprecated.to be removed in pool 2.0. UsegetTestOnReturn().ThetestOnReturnsetting for pools created by this factory. -
_testWhileIdle
Deprecated.to be removed in pool 2.0. UsegetTestWhileIdle().ThetestWhileIdlesetting for pools created by this factory. -
_timeBetweenEvictionRunsMillis
Deprecated.to be removed in pool 2.0. UsegetTimeBetweenEvictionRunsMillis().ThetimeBetweenEvictionRunsMillissetting for pools created by this factory. -
_numTestsPerEvictionRun
Deprecated.to be removed in pool 2.0. UsegetNumTestsPerEvictionRun().ThenumTestsPerEvictionRunsetting for pools created by this factory. -
_minEvictableIdleTimeMillis
Deprecated.to be removed in pool 2.0. UsegetMinEvictableIdleTimeMillis().TheminEvictableIdleTimeMillissetting for pools created by this factory. -
_softMinEvictableIdleTimeMillis
Deprecated.to be removed in pool 2.0. UsegetSoftMinEvictableIdleTimeMillis().ThesoftMinEvictableIdleTimeMillissetting for pools created by this factory. -
_lifo
Deprecated.to be removed in pool 2.0. UsegetLifo().Thelifosetting for pools created by this factory. -
_factory
Deprecated.to be removed in pool 2.0. UsegetFactory().ThePoolableObjectFactoryused by pools created by this factory.
-
-
Constructor Details
-
GenericObjectPoolFactory
Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, GenericObjectPool.Config config) throws NullPointerException Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.config- a non-nullGenericObjectPool.Config describing the configuration.- Throws:
NullPointerException- when config isnull.- See Also:
-
GenericObjectPoolFactory
Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created pools at one time.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.testOnBorrow- whether to validate objects before they are returned by the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.testOnBorrow- whether to validate objects before they are returned by the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.timeBetweenEvictionRunsMillis- the number of milliseconds to sleep between examining idle objects for eviction.numTestsPerEvictionRun- the number of idle objects to examine per run within the idle object eviction thread.minEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.testWhileIdle- whether or not to validate objects in the idle object eviction thread.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.minIdle- the minimum number of idle objects in my pool.testOnBorrow- whether to validate objects before they are returned by the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.timeBetweenEvictionRunsMillis- the number of milliseconds to sleep between examining idle objects for eviction.numTestsPerEvictionRun- the number of idle objects to examine per run within the idle object eviction thread.minEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.testWhileIdle- whether or not to validate objects in the idle object eviction thread.- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.minIdle- the minimum number of idle objects in my pool.testOnBorrow- whether to validate objects before they are returned by the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.timeBetweenEvictionRunsMillis- the number of milliseconds to sleep between examining idle objects for eviction.numTestsPerEvictionRun- the number of idle objects to examine per run within the idle object eviction thread.minEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.testWhileIdle- whether or not to validate objects in the idle object eviction thread.softMinEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction with the extra condition that at least "minIdle" amount of object remain in the pool.- Since:
- Pool 1.3
- See Also:
-
GenericObjectPoolFactory
public GenericObjectPoolFactory(PoolableObjectFactory<T> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, long softMinEvictableIdleTimeMillis, boolean lifo) Create a new GenericObjectPoolFactory.- Parameters:
factory- the PoolableObjectFactory used by created pools.maxActive- maximum number of objects that can be borrowed from created 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 my pool.minIdle- the minimum number of idle objects in my pool.testOnBorrow- whether to validate objects before they are returned by the borrowObject.testOnReturn- whether to validate objects after they are returned to the returnObject.timeBetweenEvictionRunsMillis- the number of milliseconds to sleep between examining idle objects for eviction.numTestsPerEvictionRun- the number of idle objects to examine per run within the idle object eviction thread.minEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction.testWhileIdle- whether or not to validate objects in the idle object eviction thread.softMinEvictableIdleTimeMillis- the minimum number of milliseconds an object can sit idle in the pool before it is eligible for eviction with the extra condition that at least "minIdle" amount of object remain in the pool.lifo- whether or not objects are returned in last-in-first-out order from the idle object pool.- Since:
- Pool 1.4
- See Also:
-
-
Method Details
-
createPool
Create and return a newObjectPool.- Specified by:
createPoolin interfaceObjectPoolFactory<T>- Returns:
- a new
ObjectPool
-
getMaxIdle
public int getMaxIdle()- Returns:
- the
maxIdlesetting for pools created by this factory. - Since:
- 1.5.5
-
getMinIdle
public int getMinIdle()- Returns:
- the
minIdlesetting for pools created by this factory. - Since:
- 1.5.5
-
getMaxActive
public int getMaxActive()- Returns:
- the
maxActivesetting for pools created by this factory. - Since:
- 1.5.5
-
getMaxWait
public long getMaxWait()- Returns:
- the
maxWaitsetting for pools created by this factory. - Since:
- 1.5.5
-
getWhenExhaustedAction
public byte getWhenExhaustedAction()- Returns:
- the
whenExhaustedActionsetting for pools created by this factory. - Since:
- 1.5.5
-
getTestOnBorrow
public boolean getTestOnBorrow()- Returns:
- the
testOnBorrowsetting for pools created by this factory. - Since:
- 1.5.5
-
getTestOnReturn
public boolean getTestOnReturn()- Returns:
- the
testOnReturnsetting for pools created by this factory. - Since:
- 1.5.5
-
getTestWhileIdle
public boolean getTestWhileIdle()- Returns:
- the
testWhileIdlesetting for pools created by this factory. - Since:
- 1.5.5
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()- Returns:
- the
timeBetweenEvictionRunsMillissetting for pools created by this factory. - Since:
- 1.5.5
-
getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()- Returns:
- the
numTestsPerEvictionRunsetting for pools created by this factory. - Since:
- 1.5.5
-
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()- Returns:
- the
minEvictableIdleTimeMillissetting for pools created by this factory. - Since:
- 1.5.5
-
getSoftMinEvictableIdleTimeMillis
public long getSoftMinEvictableIdleTimeMillis()- Returns:
- the
softMinEvicatableIdleTimeMillissetting for pools created by this factory. - Since:
- 1.5.5
-
getLifo
public boolean getLifo()- Returns:
- the
lifosetting for pools created by this factory. - Since:
- 1.5.5
-
getFactory
- Returns:
- the
PoolableObjectFactoryused by pools created by this factory
-