public class PowerOfTwoBufferPool extends java.lang.Object implements BufferProvider
This class should not be considered a part of the public API.
| Modifier and Type | Class and Description |
|---|---|
private class |
PowerOfTwoBufferPool.PooledByteBufNIO |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Integer,ConcurrentPool<java.nio.ByteBuffer>> |
powerOfTwoToPoolMap |
| Constructor and Description |
|---|
PowerOfTwoBufferPool()
Construct an instance with a highest power of two of 24.
|
PowerOfTwoBufferPool(int highestPowerOfTwo)
Construct an instance.
|
| Modifier and Type | Method and Description |
|---|---|
private java.nio.ByteBuffer |
createNew(int size) |
ByteBuf |
getBuffer(int size)
Gets a buffer with the givens capacity.
|
(package private) static int |
log2(int powerOfTwo) |
private void |
release(java.nio.ByteBuffer buffer) |
(package private) static int |
roundUpToNextHighestPowerOfTwo(int size) |
private final java.util.Map<java.lang.Integer,ConcurrentPool<java.nio.ByteBuffer>> powerOfTwoToPoolMap
public PowerOfTwoBufferPool()
public PowerOfTwoBufferPool(int highestPowerOfTwo)
highestPowerOfTwo - the highest power of two buffer size that will be pooledpublic ByteBuf getBuffer(int size)
BufferProvidergetBuffer in interface BufferProvidersize - the size required for the bufferprivate java.nio.ByteBuffer createNew(int size)
private void release(java.nio.ByteBuffer buffer)
static int log2(int powerOfTwo)
static int roundUpToNextHighestPowerOfTwo(int size)