TargetSource implementation that holds objects in a configurable
Jakarta Commons Pool.
By default, an instance of GenericObjectPool is created.
Subclasses may change the type of ObjectPool used by
overriding the createObjectPool() method.
Provides many configuration properties mirroring those of the Commons Pool
GenericObjectPool class; these properties are passed to the
GenericObjectPool during construction. If creating a subclass of this
class to change the ObjectPool implementation type, pass in the values
of configuration properties that are relevant to your chosen implementation.
releaseTarget(Object target) Returns the specified object to the underlying ObjectPool.
public void
setMaxIdle(int maxIdle) Set the maximum number of idle objects in the pool.
public void
setMaxWait(long maxWait) Set the maximum waiting time for fetching an object from the pool.
public void
setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Set the minimum time that an idle object can sit in the pool before
it becomes subject to eviction.
public void
setMinIdle(int minIdle) Set the minimum number of idle objects in the pool.
public void
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Set the time between eviction runs that check idle objects whether
they have been idle for too long or have become invalid.
public void
setWhenExhaustedAction(byte whenExhaustedAction) Set the action to take when the pool is exhausted.
Create a CommonsPoolTargetSource with default settings.
Default maximum size of the pool is 8.
See Also:CommonsPoolTargetSource.setMaxSize See Also: GenericObjectPool.setMaxActive
Subclasses can override this if they want to return a specific Commons pool.
They should apply any configuration properties to the pool here.
Default is a GenericObjectPool instance with the given pool size.
an empty Commons ObjectPool. See Also: org.apache.commons.pool.impl.GenericObjectPool See Also:CommonsPoolTargetSource.setMaxSize
Set the minimum number of idle objects in the pool.
Default is 0.
See Also: GenericObjectPool.setMinIdle
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)(Code)
Set the time between eviction runs that check idle objects whether
they have been idle for too long or have become invalid.
Default is -1, not performing any eviction.
See Also: GenericObjectPool.setTimeBetweenEvictionRunsMillis
setWhenExhaustedAction
public void setWhenExhaustedAction(byte whenExhaustedAction)(Code)
Set the action to take when the pool is exhausted. Uses the
constant values defined in Commons Pool's GenericObjectPool class.
See Also: GenericObjectPool.setWhenExhaustedAction(byte) See Also: GenericObjectPool.WHEN_EXHAUSTED_BLOCK See Also: GenericObjectPool.WHEN_EXHAUSTED_FAIL See Also: GenericObjectPool.WHEN_EXHAUSTED_GROW
setWhenExhaustedActionName
public void setWhenExhaustedActionName(String whenExhaustedActionName)(Code)
Set the action to take when the pool is exhausted. Uses the
constant names defined in Commons Pool's GenericObjectPool class:
"WHEN_EXHAUSTED_BLOCK", "WHEN_EXHAUSTED_FAIL", "WHEN_EXHAUSTED_GROW".
See Also:CommonsPoolTargetSource.setWhenExhaustedAction(byte)