Class AbstractObjectPoolImpl<T>

java.lang.Object
org.jppf.utils.pooling.AbstractObjectPoolImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
ObjectPool<T>

public abstract class AbstractObjectPoolImpl<T> extends Object implements ObjectPool<T>
Author:
Laurent Cohen
  • Field Details

  • Constructor Details

    • AbstractObjectPoolImpl

      public AbstractObjectPoolImpl()
  • Method Details

    • get

      public T get()
      Description copied from interface: ObjectPool
      Get an object from the pool, or create it if the pool is empty.
      Specified by:
      get in interface ObjectPool<T>
      Returns:
      a new Object of the type handled by this pool.
    • create

      protected abstract T create()
      Create a new object for the pool.
      Returns:
      an object that can be returned to the pool.
    • put

      public void put(T t)
      Description copied from interface: ObjectPool
      Release an object into this pool, and make it available.
      Specified by:
      put in interface ObjectPool<T>
      Parameters:
      t - the object to release.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ObjectPool
      Determine whether this pool is empty.
      Specified by:
      isEmpty in interface ObjectPool<T>
      Returns:
      true if the pool is empty, false otherwise.
    • size

      public int size()
      Description copied from interface: ObjectPool
      Get the number of objects in this pool. This is an optional operation, as it may not always be done in constant time.
      Specified by:
      size in interface ObjectPool<T>
      Returns:
      the size of this pool, or -1 if this operation is not supported.