Class Pool<T>

    • Field Detail

      • internalPool

        protected org.apache.commons.pool2.impl.GenericObjectPool<T> internalPool
    • Constructor Detail

      • Pool

        public Pool()
        Using this constructor means you have to set and initialize the internalPool yourself.
      • Pool

        public Pool​(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig,
                    org.apache.commons.pool2.PooledObjectFactory<T> factory)
    • Method Detail

      • isClosed

        public boolean isClosed()
      • initPool

        public void initPool​(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig,
                             org.apache.commons.pool2.PooledObjectFactory<T> factory)
      • getResource

        public T getResource()
      • returnResourceObject

        protected void returnResourceObject​(T resource)
      • returnBrokenResource

        protected void returnBrokenResource​(T resource)
      • returnResource

        protected void returnResource​(T resource)
      • destroy

        public void destroy()
      • returnBrokenResourceObject

        protected void returnBrokenResourceObject​(T resource)
      • closeInternalPool

        protected void closeInternalPool()
      • getNumActive

        public int getNumActive()
        Returns the number of instances currently borrowed from this pool.
        Returns:
        The number of instances currently borrowed from this pool, -1 if the pool is inactive.
      • getNumIdle

        public int getNumIdle()
        Returns the number of instances currently idle in this pool.
        Returns:
        The number of instances currently idle in this pool, -1 if the pool is inactive.
      • getNumWaiters

        public int getNumWaiters()
        Returns an estimate of the number of threads currently blocked waiting for a resource from this pool.
        Returns:
        The number of threads waiting, -1 if the pool is inactive.
      • getMeanBorrowWaitTimeMillis

        public long getMeanBorrowWaitTimeMillis()
        Returns the mean waiting time spent by threads to obtain a resource from this pool.
        Returns:
        The mean waiting time, in milliseconds, -1 if the pool is inactive.
      • getMaxBorrowWaitTimeMillis

        public long getMaxBorrowWaitTimeMillis()
        Returns the maximum waiting time spent by threads to obtain a resource from this pool.
        Returns:
        The maximum waiting time, in milliseconds, -1 if the pool is inactive.
      • addObjects

        public void addObjects​(int count)