Package org.apache.cassandra.io.util
Class SimpleCachedBufferPool
java.lang.Object
org.apache.cassandra.io.util.SimpleCachedBufferPool
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 Summary
ConstructorsConstructorDescriptionSimpleCachedBufferPool(int maxBufferPoolSize, int bufferSize, BufferType preferredReusableBufferType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanatLimit()Checks if the number of used buffers has exceeded the maximum number of cached buffers.voidEmpties the buffer pool.getThreadLocalReusableBuffer(int size) voidreleaseBuffer(ByteBuffer buffer) toString()
-
Constructor Details
-
SimpleCachedBufferPool
public SimpleCachedBufferPool(int maxBufferPoolSize, int bufferSize, BufferType preferredReusableBufferType)
-
-
Method Details
-
createBuffer
-
getThreadLocalReusableBuffer
-
releaseBuffer
-
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
-