org.springframework.aop.target

Class AbstractPoolingTargetSource

    • Constructor Detail

      • AbstractPoolingTargetSource

        public AbstractPoolingTargetSource()
    • Method Detail

      • 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.
        Specified by:
        getMaxSize in interface PoolingConfig
      • createPool

        protected abstract void createPool()
                                    throws java.lang.Exception
        Create the pool.
        Throws:
        java.lang.Exception - to avoid placing constraints on pooling APIs
      • getTarget

        @Nullable
        public abstract java.lang.Object getTarget()
                                                      throws java.lang.Exception
        Acquire an object from the pool.
        Specified by:
        getTarget in interface TargetSource
        Returns:
        an object from the pool
        Throws:
        java.lang.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(java.lang.Object target)
                                    throws java.lang.Exception
        Return the given object to the pool.
        Specified by:
        releaseTarget in interface TargetSource
        Overrides:
        releaseTarget in class AbstractBeanFactoryBasedTargetSource
        Parameters:
        target - object that must have been acquired from the pool via a call to getTarget()
        Throws:
        java.lang.Exception - to allow pooling APIs to throw exception
        See Also:
        getTarget()
      • getPoolingConfigMixin

        public DefaultIntroductionAdvisor getPoolingConfigMixin()
        Return an IntroductionAdvisor that providing a mixin exposing statistics about the pool maintained by this object.