public class DirectByteBufferPool extends Object implements ByteBufferPool
ByteBuffers of a specified default size in a simple fixed
size stack.
If the stack is full, the buffer is de-referenced and available to be freed by normal garbage collection (whenever
that may actually take place)| Constructor and Description |
|---|
DirectByteBufferPool(int minBufferSize,
int maxPoolSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
acquire(int size)
Borrow a buffer from the pool.
|
void |
release(ByteBuffer buffer)
Returns a buffer to the pool.
|
public DirectByteBufferPool(int minBufferSize,
int maxPoolSize)
minBufferSize - the minimum size to create buffers.maxPoolSize - the maximum buffers to keep in the pool.public ByteBuffer acquire(int size)
acquire in interface ByteBufferPoolsize - The minimum size and initial limit of the buffer.public void release(ByteBuffer buffer)
release in interface ByteBufferPoolbuffer - the buffer.Copyright © 2004–2020. All rights reserved.