Class GenericObjectPool<E extends Poolable>

java.lang.Object
com.landawn.abacus.pool.AbstractPool
com.landawn.abacus.pool.GenericObjectPool<E>
Type Parameters:
E -
All Implemented Interfaces:
ObjectPool<E>, Pool, Serializable

public class GenericObjectPool<E extends Poolable> extends AbstractPool implements ObjectPool<E>
Since:
0.8
Author:
Haiyang Li
See Also:
  • Method Details

    • add

      public boolean add(E e)
      Specified by:
      add in interface ObjectPool<E extends Poolable>
      Parameters:
      e -
      Returns:
      true, if successful
    • add

      public boolean add(E e, boolean autoDestroyOnFailedToAdd)
      Specified by:
      add in interface ObjectPool<E extends Poolable>
      Parameters:
      e -
      autoDestroyOnFailedToAdd -
      Returns:
      true, if successful
    • add

      public boolean add(E e, long timeout, TimeUnit unit) throws InterruptedException
      Specified by:
      add in interface ObjectPool<E extends Poolable>
      Parameters:
      e -
      timeout -
      unit -
      Returns:
      true, if successful
      Throws:
      InterruptedException - the interrupted exception
    • add

      public boolean add(E e, long timeout, TimeUnit unit, boolean autoDestroyOnFailedToAdd) throws InterruptedException
      Specified by:
      add in interface ObjectPool<E extends Poolable>
      Parameters:
      e -
      timeout -
      unit -
      autoDestroyOnFailedToAdd -
      Returns:
      true, if successful
      Throws:
      InterruptedException - the interrupted exception
    • take

      public E take()
      Description copied from interface: ObjectPool
      Retrieves and removes the head of this queue, or returns null if this queue is empty.
      Specified by:
      take in interface ObjectPool<E extends Poolable>
      Returns:
    • take

      public E take(long timeout, TimeUnit unit) throws InterruptedException
      Specified by:
      take in interface ObjectPool<E extends Poolable>
      Parameters:
      timeout -
      unit -
      Returns:
      Throws:
      InterruptedException - the interrupted exception
    • contains

      public boolean contains(E e)
      Specified by:
      contains in interface ObjectPool<E extends Poolable>
      Parameters:
      e -
      Returns:
      true, if successful
    • vacate

      public void vacate()
      Vacate.
      Specified by:
      vacate in interface Pool
    • clear

      public void clear()
      Clear.
      Specified by:
      clear in interface Pool
    • close

      public void close()
      Close.
      Specified by:
      close in interface Pool
    • size

      public int size()
      Specified by:
      size in interface Pool
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Parameters:
      obj -
      Returns:
      true, if successful
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns: