# Class BufferPool

java.lang.Object
org.apache.catalina.tribes.io.BufferPool

public class BufferPool extends Object
Pool for reusing byte buffers in Tribes messaging.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `BufferPool.BufferPoolAPI`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_POOL_SIZE`
  Default maximum pool size in bytes (100 MiB).
  `protected static BufferPool`
  `instance`
  Singleton instance of the buffer pool.
  `protected final BufferPool.BufferPoolAPI`
  `pool`
  `protected static final StringManager`
  `sm`
  String manager for internationalized messages.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  `XByteBuffer`
  `getBuffer(int minSize, boolean discard)`
  `static BufferPool`
  `getBufferPool()`
  Returns the singleton buffer pool instance.
  `void`
  `returnBuffer(XByteBuffer buffer)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_POOL_SIZE

    public static final int DEFAULT_POOL_SIZE
    Default maximum pool size in bytes (100 MiB).
    See Also:
      - Constant Field Values

  - ### sm

    protected static final StringManager sm
    String manager for internationalized messages.

  - ### instance

    protected static volatile BufferPool instance
    Singleton instance of the buffer pool.

  - ### pool

    protected final BufferPool.BufferPoolAPI pool

- ## Method Details

  - ### getBuffer

    public XByteBuffer getBuffer(int minSize, boolean discard)

  - ### returnBuffer

    public void returnBuffer(XByteBuffer buffer)

  - ### clear

    public void clear()

  - ### getBufferPool

    public static BufferPool getBufferPool()
    Returns the singleton buffer pool instance.
    Returns:
      the buffer pool