Interface ObjectPool<E>

Type Parameters:
E - the type of objects in the pool.
All Known Implementing Classes:
AbstractBoundedObjectPoolQueue, AbstractObjectPoolImpl, AbstractObjectPoolQueue, AbstractPoolSet, BoundedByteArrayPool, DirectBufferPoolQueue, SynchronizedDirectBufferPool

public interface ObjectPool<E>
Interface for oject pools.
Author:
Laurent Cohen
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    Get an object from the pool, or create it if the pool is empty.
    boolean
    Determine whether this pool is empty.
    void
    put(E content)
    Release an object into this pool, and make it available.
    int
    Get the number of objects in this pool.
  • Method Details

    • get

      E get()
      Get an object from the pool, or create it if the pool is empty.
      Returns:
      a new Object of the type handled by this pool.
    • put

      void put(E content)
      Release an object into this pool, and make it available.
      Parameters:
      content - the object to release.
    • isEmpty

      boolean isEmpty()
      Determine whether this pool is empty.
      Returns:
      true if the pool is empty, false otherwise.
    • size

      int size()
      Get the number of objects in this pool. This is an optional operation, as it may not always be done in constant time.
      Returns:
      the size of this pool, or -1 if this operation is not supported.