Package org.apache.cassandra.io.util
Class SimpleCachedBufferPool
- java.lang.Object
-
- org.apache.cassandra.io.util.SimpleCachedBufferPool
-
public class SimpleCachedBufferPool extends java.lang.ObjectA 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 Summary
Constructors Constructor Description SimpleCachedBufferPool(int maxBufferPoolSize, int bufferSize, BufferType preferredReusableBufferType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanatLimit()Checks if the number of used buffers has exceeded the maximum number of cached buffers.java.nio.ByteBuffercreateBuffer()voidemptyBufferPool()Empties the buffer pool.java.nio.ByteBuffergetThreadLocalReusableBuffer(int size)voidreleaseBuffer(java.nio.ByteBuffer buffer)java.lang.StringtoString()
-
-
-
Constructor Detail
-
SimpleCachedBufferPool
public SimpleCachedBufferPool(int maxBufferPoolSize, int bufferSize, BufferType preferredReusableBufferType)
-
-
Method Detail
-
createBuffer
public java.nio.ByteBuffer createBuffer()
-
getThreadLocalReusableBuffer
public java.nio.ByteBuffer getThreadLocalReusableBuffer(int size)
-
releaseBuffer
public void releaseBuffer(java.nio.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:
trueif the number of used buffers has exceeded the maximum number of cached buffers,falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-