Class AbstractPoolingTargetSource

All Implemented Interfaces:
Serializable, PoolingConfig, TargetClassAware, TargetSource, Aware, BeanFactoryAware, DisposableBean
Direct Known Subclasses:
CommonsPool2TargetSource

public abstract class AbstractPoolingTargetSource extends AbstractPrototypeBasedTargetSource implements PoolingConfig, 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 AbstractPrototypeBasedTargetSource.newPrototypeInstance() method inherited from AbstractPrototypeBasedTargetSource can be used to create objects in order to put them into the pool.

Subclasses must also implement some 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.

Author:
Rod Johnson, Juergen Hoeller
See Also:
  • Constructor Details

    • AbstractPoolingTargetSource

      public AbstractPoolingTargetSource()
  • Method Details