open class CommonsPool2TargetSource : AbstractPoolingTargetSource, PooledObjectFactory<Any>
org.springframework.aop.TargetSource implementation that holds objects in a configurable Apache Commons2 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 explicitly 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.
Compatible with Apache Commons Pool 2.4, as of Spring 4.2.
Author
Rod Johnson
Author
Rob Harrop
Author
Juergen Hoeller
Author
Stephane Nicoll
Author
Kazuki Shimizu
Since
4.2
See Also
GenericObjectPool#createObjectPool()#setMaxSize#setMaxIdle#setMinIdle#setMaxWait#setTimeBetweenEvictionRunsMillis#setMinEvictableIdleTimeMillis
CommonsPool2TargetSource()
Create a CommonsPoolTargetSource with default settings. Default maximum size of the pool is 8. |
open fun activateObject(p: PooledObject<Any>): Unit |
|
open fun destroy(): Unit
Closes the underlying |
|
open fun destroyObject(p: PooledObject<Any>): Unit |
|
open fun getActiveCount(): Int |
|
open fun getIdleCount(): Int |
|
open fun getMaxIdle(): Int
Return the maximum number of idle objects in the pool. |
|
open fun getMaxWait(): Long
Return the maximum waiting time for fetching an object from the pool. |
|
open fun getMinEvictableIdleTimeMillis(): Long
Return the minimum time that an idle object can sit in the pool. |
|
open fun getMinIdle(): Int
Return the minimum number of idle objects in the pool. |
|
open fun getTarget(): Any
Borrows an object from the |
|
open fun getTimeBetweenEvictionRunsMillis(): Long
Return the time between eviction runs that check idle objects. |
|
open fun isBlockWhenExhausted(): Boolean
Specify if the call should block when the pool is exhausted. |
|
open fun makeObject(): PooledObject<Any> |
|
open fun passivateObject(p: PooledObject<Any>): Unit |
|
open fun releaseTarget(target: Any): Unit
Returns the specified object to the underlying |
|
open fun setBlockWhenExhausted(blockWhenExhausted: Boolean): Unit
Set whether the call should bock when the pool is exhausted. |
|
open fun setMaxIdle(maxIdle: Int): Unit
Set the maximum number of idle objects in the pool. Default is 8. |
|
open fun setMaxWait(maxWait: Long): Unit
Set the maximum waiting time for fetching an object from the pool. Default is -1, waiting forever. |
|
open fun setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis: Long): Unit
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. |
|
open fun setMinIdle(minIdle: Int): Unit
Set the minimum number of idle objects in the pool. Default is 0. |
|
open fun setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis: Long): Unit
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. |
|
open fun validateObject(p: PooledObject<Any>): Boolean |