Class ApachePoolImpl<T>

  • All Implemented Interfaces:
    Pool<T,​java.lang.Exception>

    public class ApachePoolImpl<T>
    extends java.lang.Object
    implements Pool<T,​java.lang.Exception>

    Pool implementation using an Apache object pool

    Since:
    3.1
    Version:
    0.5.1
    Author:
    Michael Grove
    • Constructor Summary

      Constructors 
      Constructor Description
      ApachePoolImpl​(org.apache.commons.pool.PoolableObjectFactory<T> theFactory, int theMin, org.apache.commons.pool.impl.GenericObjectPool.Config theConfig)
      Create a new ApachePoolImpl
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T obtain()
      Get an object from the pool
      void release​(T theObj)
      Return the object to the pool
      void shutdown()
      Shutdown the pool
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApachePoolImpl

        public ApachePoolImpl​(org.apache.commons.pool.PoolableObjectFactory<T> theFactory,
                              int theMin,
                              org.apache.commons.pool.impl.GenericObjectPool.Config theConfig)
        Create a new ApachePoolImpl
        Parameters:
        theFactory - the object factory
        theMin - the min # of objects in the pool
        theConfig - the configuration of the pool
    • Method Detail

      • obtain

        public T obtain()
                 throws java.lang.Exception
        Get an object from the pool
        Specified by:
        obtain in interface Pool<T,​java.lang.Exception>
        Returns:
        the object
        Throws:
        java.lang.Exception
      • shutdown

        public void shutdown()
                      throws java.lang.Exception
        Shutdown the pool
        Specified by:
        shutdown in interface Pool<T,​java.lang.Exception>
        Throws:
        java.lang.Exception
      • release

        public void release​(T theObj)
                     throws java.lang.Exception
        Return the object to the pool
        Specified by:
        release in interface Pool<T,​java.lang.Exception>
        Parameters:
        theObj - the object
        Throws:
        java.lang.Exception