类 CommonsPoolTargetSource
- java.lang.Object
- org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
- org.springframework.aop.target.AbstractPrototypeBasedTargetSource
- org.springframework.aop.target.AbstractPoolingTargetSource
- org.springframework.aop.target.CommonsPoolTargetSource
- 所有已实现的接口:
Serializable,org.apache.commons.pool.PoolableObjectFactory,PoolingConfig,TargetClassAware,TargetSource,Aware,BeanFactoryAware,DisposableBean
@Deprecated public class CommonsPoolTargetSource extends AbstractPoolingTargetSource implements org.apache.commons.pool.PoolableObjectFactory
已过时。as of Spring 4.2, in favor ofCommonsPool2TargetSourceTargetSourceimplementation that holds objects in a configurable Apache Commons Pool.By default, an instance of
GenericObjectPoolis created. Subclasses may change the type ofObjectPoolused by overriding thecreateObjectPool()method.Provides many configuration properties mirroring those of the Commons Pool
GenericObjectPoolclass; these properties are passed to theGenericObjectPoolduring construction. If creating a subclass of this class to change theObjectPoolimplementation type, pass in the values of configuration properties that are relevant to your chosen implementation.The
testOnBorrow,testOnReturnandtestWhileIdleproperties are explicitly not mirrored because the implementation ofPoolableObjectFactoryused by this class does not implement meaningful validation. All exposed Commons Pool properties use the corresponding Commons Pool defaults.Compatible with Apache Commons Pool 1.5.x and 1.6. Note that this class doesn't declare Commons Pool 1.6's generic type in order to remain compatible with Commons Pool 1.5.x at runtime.
- 作者:
- Rod Johnson, Rob Harrop, Juergen Hoeller
- 另请参阅:
GenericObjectPool,createObjectPool(),AbstractPoolingTargetSource.setMaxSize(int),setMaxIdle(int),setMinIdle(int),setMaxWait(long),setTimeBetweenEvictionRunsMillis(long),setMinEvictableIdleTimeMillis(long), 序列化表格
字段概要
从类继承的字段 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
logger
构造器概要
构造器 构造器 说明 CommonsPoolTargetSource()已过时。Create a CommonsPoolTargetSource with default settings.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 voidactivateObject(Object obj)已过时。protected org.apache.commons.pool.ObjectPoolcreateObjectPool()已过时。Subclasses can override this if they want to return a specific Commons pool.protected voidcreatePool()已过时。Creates and holds an ObjectPool instance.voiddestroy()已过时。Closes the underlyingObjectPoolwhen destroying this object.voiddestroyObject(Object obj)已过时。intgetActiveCount()已过时。Return the number of active objects in the pool.intgetIdleCount()已过时。Return the number of idle objects in the pool.intgetMaxIdle()已过时。Return the maximum number of idle objects in the pool.longgetMaxWait()已过时。Return the maximum waiting time for fetching an object from the pool.longgetMinEvictableIdleTimeMillis()已过时。Return the minimum time that an idle object can sit in the pool.intgetMinIdle()已过时。Return the minimum number of idle objects in the pool.ObjectgetTarget()已过时。Borrow an object from theObjectPool.longgetTimeBetweenEvictionRunsMillis()已过时。Return the time between eviction runs that check idle objects.bytegetWhenExhaustedAction()已过时。Return the action to take when the pool is exhausted.ObjectmakeObject()已过时。voidpassivateObject(Object obj)已过时。voidreleaseTarget(Object target)已过时。Returns the specified object to the underlyingObjectPool.voidsetMaxIdle(int maxIdle)已过时。Set the maximum number of idle objects in the pool.voidsetMaxWait(long maxWait)已过时。Set the maximum waiting time for fetching an object from the pool.voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)已过时。Set the minimum time that an idle object can sit in the pool before it becomes subject to eviction.voidsetMinIdle(int minIdle)已过时。Set the minimum number of idle objects in the pool.voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)已过时。Set the time between eviction runs that check idle objects whether they have been idle for too long or have become invalid.voidsetWhenExhaustedAction(byte whenExhaustedAction)已过时。Set the action to take when the pool is exhausted.voidsetWhenExhaustedActionName(String whenExhaustedActionName)已过时。Set the action to take when the pool is exhausted.booleanvalidateObject(Object obj)已过时。从类继承的方法 org.springframework.aop.target.AbstractPoolingTargetSource
getMaxSize, getPoolingConfigMixin, setBeanFactory, setMaxSize
从类继承的方法 org.springframework.aop.target.AbstractPrototypeBasedTargetSource
destroyPrototypeInstance, newPrototypeInstance, writeReplace
从类继承的方法 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, setTargetBeanName, setTargetClass, toString
构造器详细资料
CommonsPoolTargetSource
public CommonsPoolTargetSource()
已过时。Create a CommonsPoolTargetSource with default settings. Default maximum size of the pool is 8.- 另请参阅:
AbstractPoolingTargetSource.setMaxSize(int),GenericObjectPool.setMaxActive(int)
方法详细资料
setMaxIdle
public void setMaxIdle(int maxIdle)
已过时。Set the maximum number of idle objects in the pool. Default is 8.- 另请参阅:
GenericObjectPool.setMaxIdle(int)
getMaxIdle
public int getMaxIdle()
已过时。Return the maximum number of idle objects in the pool.
setMinIdle
public void setMinIdle(int minIdle)
已过时。Set the minimum number of idle objects in the pool. Default is 0.- 另请参阅:
GenericObjectPool.setMinIdle(int)
getMinIdle
public int getMinIdle()
已过时。Return the minimum number of idle objects in the pool.
setMaxWait
public void setMaxWait(long maxWait)
已过时。Set the maximum waiting time for fetching an object from the pool. Default is -1, waiting forever.- 另请参阅:
GenericObjectPool.setMaxWait(long)
getMaxWait
public long getMaxWait()
已过时。Return the maximum waiting time for fetching an object from the pool.
setTimeBetweenEvictionRunsMillis
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. Default is -1, not performing any eviction.- 另请参阅:
GenericObjectPool.setTimeBetweenEvictionRunsMillis(long)
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()
已过时。Return the time between eviction runs that check idle objects.
setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
已过时。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),GenericObjectPool.setMinEvictableIdleTimeMillis(long)
getMinEvictableIdleTimeMillis
public long getMinEvictableIdleTimeMillis()
已过时。Return the minimum time that an idle object can sit in the pool.
setWhenExhaustedActionName
public void setWhenExhaustedActionName(String whenExhaustedActionName)
已过时。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".
setWhenExhaustedAction
public void setWhenExhaustedAction(byte whenExhaustedAction)
已过时。Set the action to take when the pool is exhausted. Uses the constant values defined in Commons Pool's GenericObjectPool class.- 另请参阅:
GenericObjectPool.setWhenExhaustedAction(byte),GenericObjectPool.WHEN_EXHAUSTED_BLOCK,GenericObjectPool.WHEN_EXHAUSTED_FAIL,GenericObjectPool.WHEN_EXHAUSTED_GROW
getWhenExhaustedAction
public byte getWhenExhaustedAction()
已过时。Return the action to take when the pool is exhausted.
createPool
protected final void createPool()
已过时。Creates and holds an ObjectPool instance.- 指定者:
createPool在类中AbstractPoolingTargetSource- 另请参阅:
createObjectPool()
createObjectPool
protected org.apache.commons.pool.ObjectPool createObjectPool()
已过时。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. - 另请参阅:
GenericObjectPool,AbstractPoolingTargetSource.setMaxSize(int)
getTarget
public Object getTarget() throws Exception
已过时。Borrow an object from theObjectPool.- 指定者:
getTarget在接口中TargetSource- 指定者:
getTarget在类中AbstractPoolingTargetSource- 返回:
- an object from the pool
- 抛出:
Exception- we may need to deal with checked exceptions from pool APIs, so we're forgiving with our exception signature
releaseTarget
public void releaseTarget(Object target) throws Exception
已过时。Returns the specified object to the underlyingObjectPool.- 指定者:
releaseTarget在接口中TargetSource- 指定者:
releaseTarget在类中AbstractPoolingTargetSource- 参数:
target- object that must have been acquired from the pool via a call togetTarget()- 抛出:
Exception- to allow pooling APIs to throw exception- 另请参阅:
AbstractPoolingTargetSource.getTarget()
getActiveCount
public int getActiveCount() throws UnsupportedOperationException
已过时。从接口复制的说明:PoolingConfigReturn the number of active objects in the pool.- 指定者:
getActiveCount在接口中PoolingConfig- 抛出:
UnsupportedOperationException- if not supported by the pool
getIdleCount
public int getIdleCount() throws UnsupportedOperationException
已过时。从接口复制的说明:PoolingConfigReturn the number of idle objects in the pool.- 指定者:
getIdleCount在接口中PoolingConfig- 抛出:
UnsupportedOperationException- if not supported by the pool
destroy
public void destroy() throws Exception
已过时。Closes the underlyingObjectPoolwhen destroying this object.- 指定者:
destroy在接口中DisposableBean- 抛出:
Exception- in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources as well.
makeObject
public Object makeObject() throws BeansException
已过时。- 指定者:
makeObject在接口中org.apache.commons.pool.PoolableObjectFactory- 抛出:
BeansException
destroyObject
public void destroyObject(Object obj) throws Exception
已过时。- 指定者:
destroyObject在接口中org.apache.commons.pool.PoolableObjectFactory- 抛出:
Exception
validateObject
public boolean validateObject(Object obj)
已过时。- 指定者:
validateObject在接口中org.apache.commons.pool.PoolableObjectFactory
activateObject
public void activateObject(Object obj)
已过时。- 指定者:
activateObject在接口中org.apache.commons.pool.PoolableObjectFactory
passivateObject
public void passivateObject(Object obj)
已过时。- 指定者:
passivateObject在接口中org.apache.commons.pool.PoolableObjectFactory