Interface Pool<T>

All Known Subinterfaces:
LogBufferPool, LogEntryPool, Pool.MultiGiver<T>, Pool.MultiPool<T>, Pool.MultiTaker<T>, Pool.SinglePool<T>, PoolEx<T>
All Known Implementing Classes:
DynamicDelayedLogEntryPoolImpl, DynamicLogBufferPoolImpl, DynamicLogEntryPoolImpl, LogBufferPoolImpl, LogEntryPoolImpl, ThreadSafeFixedSizePool, ThreadSafeFixedSizePool, ThreadSafeLenientFixedSizePool, ThreadSafeLenientFixedSizePool

public interface Pool<T>
Provides a pool of reusable items. Using a pool avoids garbage creation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
    static interface 
    Must implement at least: Multiple threads may call give(), one thread may call take()
    static interface 
    Must implement at least: Multiple threads may call give(), multiple threads may call take()
    static interface 
    Must implement at least: Multiple threads may call take(), one thread may call give()
    static interface 
    Must implement at least: One thread may call give(), one thread may call take()
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    give(T item)
    Gives an unused item back to the pool.
    Takes an item from the pool.
  • Method Details

    • take

      T take()
      Takes an item from the pool. Depending on pool policy, if there are no items available, this may block, create a new item, or throw a PoolEmptyException.
    • give

      void give(T item)
      Gives an unused item back to the pool. Passing null is safe and has no effect. If the pool has a clearing procedure, the item will be cleared. Depending on pool policy, if the pool is full, this may block, discard the item, or throw a PoolFullException.