Package org.xerial.snappy.pool
Class QuiescentBufferPool
- java.lang.Object
-
- org.xerial.snappy.pool.QuiescentBufferPool
-
- All Implemented Interfaces:
BufferPool
public final class QuiescentBufferPool extends java.lang.Object implements BufferPool
ABufferPoolimplementation which does no pooling. New instances will be created for each call to allocate.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]allocateArray(int size)Creates a newbyte[]of size.java.nio.ByteBufferallocateDirect(int size)Allocatesa directByteBufferof size.static BufferPoolgetInstance()voidreleaseArray(byte[] buffer)Does nothing.voidreleaseDirect(java.nio.ByteBuffer buffer)Aggressively releases native resources associated with buffer.
-
-
-
Method Detail
-
getInstance
public static BufferPool getInstance()
- Returns:
- Instance of
BufferPoolwhich does no caching/reuse of instances.
-
allocateArray
public byte[] allocateArray(int size)
Creates a newbyte[]of size.- Specified by:
allocateArrayin interfaceBufferPool- Parameters:
size- The minimum size array required. Must be>= 0.- Returns:
- A
byte[]with length of at least size. - See Also:
BufferPool.releaseArray(byte[])
-
releaseArray
public void releaseArray(byte[] buffer)
Does nothing.- Specified by:
releaseArrayin interfaceBufferPool- Parameters:
buffer- Instance to return to pool. Must not benull. Must not be returned more than 1 time. Must not be used by caller after return.
-
allocateDirect
public java.nio.ByteBuffer allocateDirect(int size)
Allocatesa directByteBufferof size.- Specified by:
allocateDirectin interfaceBufferPool- Parameters:
size- The minimum size buffer required. Must be>= 0.- Returns:
- A
ByteBufferof size or greatercapacity. - See Also:
BufferPool.releaseDirect(ByteBuffer),ByteBuffer.allocateDirect(int)
-
releaseDirect
public void releaseDirect(java.nio.ByteBuffer buffer)
Aggressively releases native resources associated with buffer.- Specified by:
releaseDirectin interfaceBufferPool- Parameters:
buffer- Instance to return to pool. Must not benull. Must not be returned more than 1 time. Must not be used by caller after return.
-
-