程序包 infra.aop.target
类 AbstractPoolingTargetSource
java.lang.Object
infra.aop.target.AbstractBeanFactoryTargetSource
infra.aop.target.AbstractPrototypeTargetSource
infra.aop.target.AbstractPoolingTargetSource
- 所有已实现的接口:
PoolingConfig,TargetClassAware,TargetSource,infra.beans.factory.Aware,infra.beans.factory.BeanFactoryAware,infra.beans.factory.DisposableBean,Serializable
- 直接已知子类:
CommonsPool2TargetSource
public abstract class AbstractPoolingTargetSource
extends AbstractPrototypeTargetSource
implements PoolingConfig, infra.beans.factory.DisposableBean
Abstract base class for pooling
TargetSource
implementations which maintain a pool of target instances, acquiring and
releasing a target object from the pool for each method invocation.
This abstract base class is independent of concrete pooling technology;
see the subclass CommonsPool2TargetSource for a concrete example.
Subclasses must implement the getTarget() and
releaseTarget(java.lang.Object) methods based on their chosen object pool.
The AbstractPrototypeTargetSource.newPrototypeInstance() method inherited from
AbstractPrototypeTargetSource can be used to create objects
in order to put them into the pool.
Subclasses must also implement some of the monitoring methods from the
PoolingConfig interface. The getPoolingConfigMixin() method
makes these stats available on proxied objects through an IntroductionAdvisor.
This class implements the DisposableBean
interface in order to force subclasses to implement a DisposableBean.destroy()
method, closing down their object pool.
- 从以下版本开始:
- 4.0
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
-
getTarget()releaseTarget(java.lang.Object)DisposableBean.destroy()- 序列化表格
-
字段概要
字段从类继承的字段 infra.aop.target.AbstractBeanFactoryTargetSource
logger -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected abstract voidCreate the pool.intReturn the maximum size of the pool.Return an IntroductionAdvisor that provides a mixin exposing statistics about the pool maintained by this object.abstract ObjectAcquire an object from the pool.abstract voidreleaseTarget(Object target) Return the given object to the pool.final voidsetBeanFactory(infra.beans.factory.BeanFactory beanFactory) Set the owning BeanFactory.voidsetMaxSize(int maxSize) Set the maximum size of the pool.从类继承的方法 infra.aop.target.AbstractPrototypeTargetSource
destroyPrototypeInstance, newPrototypeInstance, writeReplace从类继承的方法 infra.aop.target.AbstractBeanFactoryTargetSource
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, setTargetBeanName, setTargetClass, toString从接口继承的方法 infra.beans.factory.DisposableBean
destroy从接口继承的方法 infra.aop.target.PoolingConfig
getActiveCount, getIdleCount
-
字段详细资料
-
maxSize
private int maxSizeThe maximum size of the pool.
-
-
构造器详细资料
-
AbstractPoolingTargetSource
public AbstractPoolingTargetSource()
-
-
方法详细资料
-
setMaxSize
public void setMaxSize(int maxSize) Set the maximum size of the pool. Default is -1, indicating no size limit. -
getMaxSize
public int getMaxSize()Return the maximum size of the pool.- 指定者:
getMaxSize在接口中PoolingConfig
-
setBeanFactory
public final void setBeanFactory(infra.beans.factory.BeanFactory beanFactory) throws infra.beans.BeansException 从类复制的说明:AbstractBeanFactoryTargetSourceSet the owning BeanFactory. We need to save a reference so that we can use thegetBeanmethod on every invocation.- 指定者:
setBeanFactory在接口中infra.beans.factory.BeanFactoryAware- 覆盖:
setBeanFactory在类中AbstractPrototypeTargetSource- 抛出:
infra.beans.BeansException
-
createPool
Create the pool.- 抛出:
Exception- to avoid placing constraints on pooling APIs
-
getTarget
Acquire an object from the pool.- 指定者:
getTarget在接口中TargetSource- 返回:
- 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
Return the given object to the pool.- 指定者:
releaseTarget在接口中TargetSource- 覆盖:
releaseTarget在类中AbstractBeanFactoryTargetSource- 参数:
target- object that must have been acquired from the pool via a call togetTarget()- 抛出:
Exception- to allow pooling APIs to throw exception- 另请参阅:
-
getPoolingConfigMixin
Return an IntroductionAdvisor that provides a mixin exposing statistics about the pool maintained by this object.
-