Class ObjectPool<T>

java.lang.Object
com.sun.xml.ws.db.toplink.ObjectPool<T>
Type Parameters:
T - the type of the object to pool

public abstract class ObjectPool<T> extends Object
Object pool allocator that leverages a ConcurrentLinkedQueue for synchronization.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    final T
    Allocate an object from the pool or create a new one if we cannot get one from the queue.
    protected abstract T
    Subclasses must override the object creation method.
    final void
    replace(T value)
    Return an object to the pool.

    Methods inherited from class java.lang.Object

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

    • ObjectPool

      protected ObjectPool()
      Default constructor.
  • Method Details

    • allocate

      public final T allocate()
      Allocate an object from the pool or create a new one if we cannot get one from the queue.
      Returns:
      the queued or newly-created object
    • replace

      public final void replace(T value)
      Return an object to the pool.
      Parameters:
      value - the object being returned
    • newInstance

      protected abstract T newInstance()
      Subclasses must override the object creation method.
      Returns:
      a new instance of the object.