Package org.apache.cassandra.io.util
Class ThreadLocalByteBufferHolder
- java.lang.Object
-
- org.apache.cassandra.io.util.ThreadLocalByteBufferHolder
-
public final class ThreadLocalByteBufferHolder extends java.lang.Object
Utility class that allow buffers to be reused by storing them in a thread local instance.
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalByteBufferHolder(BufferType bufferType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
getBuffer(int size)
Returns the buffer for the current thread.
-
-
-
Constructor Detail
-
ThreadLocalByteBufferHolder
public ThreadLocalByteBufferHolder(BufferType bufferType)
-
-
Method Detail
-
getBuffer
public java.nio.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.
-
-