Class ThreadLocalByteBufferHolder

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

public final class ThreadLocalByteBufferHolder extends Object
Utility class that allow buffers to be reused by storing them in a thread local instance.
  • Constructor Details

    • ThreadLocalByteBufferHolder

      public ThreadLocalByteBufferHolder(BufferType bufferType)
  • Method Details

    • getBuffer

      public ByteBuffer getBuffer(int size)
      Returns the buffer for the current thread.

      If the buffer for the current thread does not have a capacity large enough. A new buffer with the requested size will be instatiated an will replace the existing one.

      Parameters:
      size - the buffer size
      Returns:
      the buffer for the current thread.