类 CommonsPool2TargetSource

    • 方法详细资料

      • 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.
        另请参阅:
        BaseGenericObjectPool.setMaxWaitMillis(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.
        另请参阅:
        BaseGenericObjectPool.setTimeBetweenEvictionRunsMillis(long)
      • 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), BaseGenericObjectPool.setMinEvictableIdleTimeMillis(long)
      • setBlockWhenExhausted

        public void setBlockWhenExhausted​(boolean blockWhenExhausted)
        Set whether the call should bock when the pool is exhausted.
      • isBlockWhenExhausted

        public boolean isBlockWhenExhausted()
        Specify if the call should block when the pool is exhausted.
      • createObjectPool

        protected org.apache.commons.pool2.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)
      • destroy

        public void destroy()
                     throws Exception
        Closes the underlying ObjectPool when 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.
      • destroyObject

        public void destroyObject​(org.apache.commons.pool2.PooledObject<Object> p)
                           throws Exception
        指定者:
        destroyObject 在接口中 org.apache.commons.pool2.PooledObjectFactory<Object>
        抛出:
        Exception
      • validateObject

        public boolean validateObject​(org.apache.commons.pool2.PooledObject<Object> p)
        指定者:
        validateObject 在接口中 org.apache.commons.pool2.PooledObjectFactory<Object>
      • activateObject

        public void activateObject​(org.apache.commons.pool2.PooledObject<Object> p)
                            throws Exception
        指定者:
        activateObject 在接口中 org.apache.commons.pool2.PooledObjectFactory<Object>
        抛出:
        Exception