# Class BufferPool

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

public class BufferPool extends Object

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_POOL_SIZE`
  `protected static BufferPool`
  `instance`
  `protected int`
  `maxSize`
  `protected final ConcurrentLinkedQueue<XByteBuffer>`
  `queue`
  `protected final AtomicInteger`
  `size`
  `protected static final StringManager`
  `sm`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  `XByteBuffer`
  `getBuffer(int minSize, boolean discard)`
  `static BufferPool`
  `getBufferPool()`
  `int`
  `getMaxSize()`
  `void`
  `returnBuffer(XByteBuffer buffer)`
  `void`
  `setMaxSize(int bytes)`

  ### Methods inherited from class java.lang.Object

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

- ## Field Details

  - ### DEFAULT_POOL_SIZE

    public static final int DEFAULT_POOL_SIZE

  - ### sm

    protected static final StringManager sm

  - ### instance

    protected static volatile BufferPool instance

  - ### maxSize

    protected int maxSize

  - ### size

    protected final AtomicInteger size

  - ### queue

    protected final ConcurrentLinkedQueue<XByteBuffer> queue

- ## Method Details

  - ### getBufferPool

    public static BufferPool getBufferPool()

  - ### getBuffer

    public XByteBuffer getBuffer(int minSize, boolean discard)

  - ### returnBuffer

    public void returnBuffer(XByteBuffer buffer)

  - ### clear

    public void clear()

  - ### setMaxSize

    public void setMaxSize(int bytes)

  - ### getMaxSize

    public int getMaxSize()