org.springframework.aop.target

## 类 AbstractPoolingTargetSource

- java.lang.Object
- - org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
  - - org.springframework.aop.target.AbstractPrototypeBasedTargetSource
    - - org.springframework.aop.target.AbstractPoolingTargetSource

- 所有已实现的接口:
    Serializable, PoolingConfig, TargetClassAware, TargetSource, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean
  直接已知子类:
    CommonsPool2TargetSource

      public abstract class AbstractPoolingTargetSource
      extends AbstractPrototypeBasedTargetSource
      implements PoolingConfig, org.springframework.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 `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 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.

  作者:
    Rod Johnson, Juergen Hoeller
  另请参阅:
    `getTarget()`, `releaseTarget(java.lang.Object)`, `DisposableBean.destroy()`, 序列化表格

- - ### 字段概要

    - ### 从类继承的字段 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

      `logger`

  - ### 构造器概要

    构造器
    构造器和说明
    `AbstractPoolingTargetSource()`

  - ### 方法概要

    所有方法 实例方法 抽象方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected abstract void` | `createPool()` Create the pool.
    `int` | `getMaxSize()` Return the maximum size of the pool.
    `DefaultIntroductionAdvisor` | `getPoolingConfigMixin()` Return an IntroductionAdvisor that providing a mixin exposing statistics about the pool maintained by this object.
    `abstract Object` | `getTarget()` Acquire an object from the pool.
    `abstract void` | `releaseTarget(Object target)` Return the given object to the pool.
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)` Set the owning BeanFactory.
    `void` | `setMaxSize(int maxSize)` Set the maximum size of the pool.

    - ### 从类继承的方法 org.springframework.aop.target.AbstractPrototypeBasedTargetSource

      `destroyPrototypeInstance, newPrototypeInstance, writeReplace`

    - ### 从类继承的方法 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

      `copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, setTargetBeanName, setTargetClass, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### 从接口继承的方法 org.springframework.aop.target.PoolingConfig

      `getActiveCount, getIdleCount`

    - ### 从接口继承的方法 org.springframework.beans.factory.DisposableBean

      `destroy`

- - ### 构造器详细资料

    - #### 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(org.springframework.beans.factory.BeanFactory beanFactory)
                                    throws org.springframework.beans.BeansException

      从类复制的说明: `AbstractBeanFactoryBasedTargetSource`
      Set the owning BeanFactory. We need to save a reference so that we can use the `getBean` method on every invocation.
      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`
      覆盖:
        `setBeanFactory` 在类中 `AbstractPrototypeBasedTargetSource`
      抛出:
        `org.springframework.beans.BeansException`

    - #### createPool

          protected abstract void createPool()
                                      throws Exception

      Create the pool.
      抛出:
        `Exception` - to avoid placing constraints on pooling APIs

    - #### getTarget

          @Nullable
          public abstract Object getTarget()
                                               throws Exception

      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

          public abstract void releaseTarget(Object target)
                                      throws Exception

      Return the given object to the pool.
      指定者:
        `releaseTarget` 在接口中 `TargetSource`
      覆盖:
        `releaseTarget` 在类中 `AbstractBeanFactoryBasedTargetSource`
      参数:
        `target` - object that must have been acquired from the pool via a call to `getTarget()`
      抛出:
        `Exception` - to allow pooling APIs to throw exception
      另请参阅:
        `getTarget()`

    - #### getPoolingConfigMixin

          public DefaultIntroductionAdvisor getPoolingConfigMixin()

      Return an IntroductionAdvisor that providing a mixin exposing statistics about the pool maintained by this object.