public final class QuiescentBufferPool extends Object implements BufferPool
BufferPool
implementation which does no pooling. New instances will be created for each call to allocate.Modifier and Type | Method and Description |
---|---|
byte[] |
allocateArray(int size)
Creates a new
byte[] of size. |
ByteBuffer |
allocateDirect(int size)
Allocates a direct ByteBuffer of size. |
static BufferPool |
getInstance() |
void |
releaseArray(byte[] buffer)
Does nothing.
|
void |
releaseDirect(ByteBuffer buffer)
Aggressively releases native resources associated with buffer.
|
public static BufferPool getInstance()
BufferPool
which does no caching/reuse of instances.public byte[] allocateArray(int size)
byte[]
of size.allocateArray
in interface BufferPool
size
- The minimum size array required. Must be >= 0
.byte[]
with length of at least size.BufferPool.releaseArray(byte[])
public void releaseArray(byte[] buffer)
releaseArray
in interface BufferPool
buffer
- Instance to return to pool. Must not be null
.
Must not be returned more than 1 time. Must not be used by caller after return.public ByteBuffer allocateDirect(int size)
Allocates
a direct ByteBuffer
of size.allocateDirect
in interface BufferPool
size
- The minimum size buffer required. Must be >= 0
.ByteBuffer
of size or greater capacity
.BufferPool.releaseDirect(ByteBuffer)
,
ByteBuffer.allocateDirect(int)
public void releaseDirect(ByteBuffer buffer)
releaseDirect
in interface BufferPool
buffer
- Instance to return to pool. Must not be null
.
Must not be returned more than 1 time. Must not be used by caller after return.Copyright © 2024 xerial.org. All rights reserved.