Package org.xerial.snappy.pool
Class QuiescentBufferPool
java.lang.Object
org.xerial.snappy.pool.QuiescentBufferPool
- All Implemented Interfaces:
BufferPool
A
BufferPool
implementation which does no pooling. New instances will be created for each call to allocate.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
allocateArray
(int size) Creates a newbyte[]
of size.allocateDirect
(int size) Allocates
a directByteBuffer
of size.static BufferPool
void
releaseArray
(byte[] buffer) Does nothing.void
releaseDirect
(ByteBuffer buffer) Aggressively releases native resources associated with buffer.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
QuiescentBufferPool
private QuiescentBufferPool()
-
-
Method Details
-
getInstance
- Returns:
- Instance of
BufferPool
which does no caching/reuse of instances.
-
allocateArray
public byte[] allocateArray(int size) Creates a newbyte[]
of size.- Specified by:
allocateArray
in interfaceBufferPool
- Parameters:
size
- The minimum size array required. Must be>= 0
.- Returns:
- A
byte[]
with length of at least size. - See Also:
-
releaseArray
public void releaseArray(byte[] buffer) Does nothing.- Specified by:
releaseArray
in 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
Allocates
a directByteBuffer
of size.- Specified by:
allocateDirect
in interfaceBufferPool
- Parameters:
size
- The minimum size buffer required. Must be>= 0
.- Returns:
- A
ByteBuffer
of size or greatercapacity
. - See Also:
-
releaseDirect
Aggressively releases native resources associated with buffer.- Specified by:
releaseDirect
in 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.
-