Class GenericPool

java.lang.Object
de.intarsys.tools.pool.GenericPool
All Implemented Interfaces:
IPool

public class GenericPool extends Object implements IPool
A very simple implementation of a generic IPool.
  • Constructor Details

  • Method Details

    • checkin

      public void checkin(Object object) throws Exception
      Description copied from interface: IPool
      Add an object to the pool.
      Specified by:
      checkin in interface IPool
      Parameters:
      object - The object to be added to the pool.
      Throws:
      Exception
    • deactivateObject

      protected void deactivateObject(Object object) throws Exception
      Throws:
      Exception
    • destroyObject

      protected void destroyObject(Object object) throws Exception
      Throws:
      Exception
    • isClosed

      protected boolean isClosed()
    • assertOpen

      protected void assertOpen()
    • checkout

      public Object checkout(long timeout) throws Exception
      Description copied from interface: IPool
      Get an object from the pool.

      This may be a reused object or a new one, up to the pool strategy and size.

      Specified by:
      checkout in interface IPool
      Parameters:
      timeout - The maximum time to wait for an instance to be available in milliseconds. -1 will wait indefinitely, 0 will not wait.
      Returns:
      A new object from the pool.
      Throws:
      Exception
    • activateObject

      protected void activateObject(Object object) throws Exception
      Throws:
      Exception
    • createObject

      protected Object createObject() throws Exception
      Throws:
      Exception
    • close

      public void close() throws Exception
      Description copied from interface: IPool
      Close the pool.
      Specified by:
      close in interface IPool
      Throws:
      Exception
    • destroy

      public void destroy(Object object) throws Exception
      Description copied from interface: IPool
      Destroy an object previously allocated from the pool.
      Specified by:
      destroy in interface IPool
      Parameters:
      object - The object to be destroyed.
      Throws:
      Exception