java.lang.Object | ||||
↳ | org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource | |||
↳ | org.springframework.aop.target.AbstractPrototypeBasedTargetSource | |||
↳ | org.springframework.aop.target.AbstractPoolingTargetSource | |||
↳ | org.springframework.aop.target.CommonsPoolTargetSource |
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.
The testOnBorrow
, testOnReturn
and testWhileIdle
properties are explictly not mirrored because the implementation of
PoolableObjectFactory
used by this class does not implement
meaningful validation. All exposed Commons Pool properties use the corresponding
Commons Pool defaults: for example,
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a CommonsPoolTargetSource with default settings.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes the underlying
ObjectPool when destroying this object. | |||||||||||
Return the maximum number of idle objects in the pool.
| |||||||||||
Return the maximum waiting time for fetching an object from the pool.
| |||||||||||
Return the minimum time that an idle object can sit in the pool.
| |||||||||||
Return the minimum number of idle objects in the pool.
| |||||||||||
Borrow an object from the
ObjectPool . | |||||||||||
Return the time between eviction runs that check idle objects.
| |||||||||||
Return the action to take when the pool is exhausted.
| |||||||||||
Returns the specified object to the underlying
ObjectPool . | |||||||||||
Set the maximum number of idle objects in the pool.
| |||||||||||
Set the maximum waiting time for fetching an object from the pool.
| |||||||||||
Set the minimum time that an idle object can sit in the pool before
it becomes subject to eviction.
| |||||||||||
Set the minimum number of idle objects in the pool.
| |||||||||||
Set the time between eviction runs that check idle objects whether
they have been idle for too long or have become invalid.
| |||||||||||
Set the action to take when the pool is exhausted.
| |||||||||||
Set the action to take when the pool is exhausted.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Subclasses can override this if they want to return a specific Commons pool.
| |||||||||||
Creates and holds an ObjectPool instance.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.aop.target.AbstractPoolingTargetSource
| |||||||||||
From class
org.springframework.aop.target.AbstractPrototypeBasedTargetSource
| |||||||||||
From class
org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.aop.TargetClassAware
| |||||||||||
From interface
org.springframework.aop.TargetSource
| |||||||||||
From interface
org.springframework.aop.target.PoolingConfig
| |||||||||||
From interface
org.springframework.beans.factory.BeanFactoryAware
| |||||||||||
From interface
org.springframework.beans.factory.DisposableBean
|
Create a CommonsPoolTargetSource with default settings. Default maximum size of the pool is 8.
setMaxSize(int)
Closes the underlying ObjectPool
when destroying this object.
Exception |
---|
Return the maximum number of idle objects in the pool.
Return the maximum waiting time for fetching an object from the pool.
Return the minimum time that an idle object can sit in the pool.
Return the minimum number of idle objects in the pool.
Return the time between eviction runs that check idle objects.
Return the action to take when the pool is exhausted.
Returns the specified object to the underlying ObjectPool
.
target | object that must have been acquired from the pool
via a call to getTarget() |
---|
Exception |
---|
Set the maximum number of idle objects in the pool. Default is 8.
Set the maximum waiting time for fetching an object from the pool. Default is -1, waiting forever.
Set the minimum time that an idle object can sit in the pool before it becomes subject to eviction. Default is 1800000 (30 minutes).
Note that eviction runs need to be performed to take this setting into effect.
setTimeBetweenEvictionRunsMillis(long)
Set the minimum number of idle objects in the pool. Default is 0.
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.
Set the action to take when the pool is exhausted. Uses the constant values defined in Commons Pool's GenericObjectPool class.
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".
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.
ObjectPool
.setMaxSize(int)
Creates and holds an ObjectPool instance.