Class ObjectPool<T>


  • public class ObjectPool<T>
    extends Object
    • Constructor Detail

    • Method Detail

      • isShutdown

        public boolean isShutdown()
        Get the state of the pool.
        Returns:
        true if the shutdown() method was called before.
      • isDisposing

        public boolean isDisposing()
      • getPoolName

        public String getPoolName()
      • setPoolName

        public void setPoolName​(String poolName)
      • borrowObject

        public ObjectPoolEntry<T> borrowObject()
        Borrow an object from the pool.
        Returns:
        An object
      • disposeAllObjects

        public void disposeAllObjects()
        Disposes all objects in the pool.

        Existing active objects will remain alive and be allowed to shutdown gracefully. Unlike shutdown, the pool will be able to work on and create new objects.

      • shutdown

        public void shutdown()
        Closes any idle objects in the pool.

        Existing active objects will remain alive and be allowed to shutdown gracefully, but no more objects will be allocated.

      • getStatistics

        public ObjectPool.Statistics getStatistics()
        Gets a snapshot of the pool's stats at a point in time.
        Returns:
        The statistics