Class SimpleCachedBufferPool

java.lang.Object
org.apache.cassandra.io.util.SimpleCachedBufferPool

public class SimpleCachedBufferPool extends Object
A very simple Bytebuffer pool with a fixed allocation size and a cached max allocation count. Will allow you to go past the "max", freeing all buffers allocated beyond the max buffer count on release. Has a reusable thread local ByteBuffer that users can make use of.
  • Constructor Details

    • SimpleCachedBufferPool

      public SimpleCachedBufferPool(int maxBufferPoolSize, int bufferSize, BufferType preferredReusableBufferType)
  • Method Details

    • createBuffer

      public ByteBuffer createBuffer()
    • getThreadLocalReusableBuffer

      public ByteBuffer getThreadLocalReusableBuffer(int size)
    • releaseBuffer

      public void releaseBuffer(ByteBuffer buffer)
    • emptyBufferPool

      public void emptyBufferPool()
      Empties the buffer pool.
    • atLimit

      public boolean atLimit()
      Checks if the number of used buffers has exceeded the maximum number of cached buffers.
      Returns:
      true if the number of used buffers has exceeded the maximum number of cached buffers, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object