public final class UnpooledByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider
ByteBufAllocator implementation that does not pool anything.| 限定符和类型 | 字段和说明 |
|---|---|
static UnpooledByteBufAllocator |
DEFAULT
Default instance which uses leak-detection for direct buffers.
|
| 构造器和说明 |
|---|
UnpooledByteBufAllocator(boolean preferDirect)
Create a new instance which uses leak-detection for direct buffers.
|
UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector)
Create a new instance
|
UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector,
boolean tryNoCleaner)
Create a new instance
|
| 限定符和类型 | 方法和说明 |
|---|---|
CompositeByteBuf |
compositeDirectBuffer(int maxNumComponents)
Allocate a direct
CompositeByteBuf with the given maximum number of components that can be stored in it. |
CompositeByteBuf |
compositeHeapBuffer(int maxNumComponents)
Allocate a heap
CompositeByteBuf with the given maximum number of components that can be stored in it. |
boolean |
isDirectBufferPooled()
Returns
true if direct ByteBuf's are pooled |
ByteBufAllocatorMetric |
metric()
Returns a
ByteBufAllocatorMetric for a ByteBufAllocator. |
protected ByteBuf |
newDirectBuffer(int initialCapacity,
int maxCapacity)
Create a direct
ByteBuf with the given initialCapacity and maxCapacity. |
protected ByteBuf |
newHeapBuffer(int initialCapacity,
int maxCapacity)
Create a heap
ByteBuf with the given initialCapacity and maxCapacity. |
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toStringpublic static final UnpooledByteBufAllocator DEFAULT
public UnpooledByteBufAllocator(boolean preferDirect)
preferDirect - true if AbstractByteBufAllocator.buffer(int) should try to allocate a direct buffer rather than
a heap bufferpublic UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector)
preferDirect - true if AbstractByteBufAllocator.buffer(int) should try to allocate a direct buffer rather than
a heap bufferdisableLeakDetector - true if the leak-detection should be disabled completely for this
allocator. This can be useful if the user just want to depend on the GC to handle
direct buffers when not explicit released.public UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector,
boolean tryNoCleaner)
preferDirect - true if AbstractByteBufAllocator.buffer(int) should try to allocate a direct buffer rather than
a heap bufferdisableLeakDetector - true if the leak-detection should be disabled completely for this
allocator. This can be useful if the user just want to depend on the GC to handle
direct buffers when not explicit released.tryNoCleaner - true if we should try to use PlatformDependent.allocateDirectNoCleaner(int)
to allocate direct memory.protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocatorByteBuf with the given initialCapacity and maxCapacity.newHeapBuffer 在类中 AbstractByteBufAllocatorprotected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocatorByteBuf with the given initialCapacity and maxCapacity.newDirectBuffer 在类中 AbstractByteBufAllocatorpublic CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
ByteBufAllocatorCompositeByteBuf with the given maximum number of components that can be stored in it.compositeHeapBuffer 在接口中 ByteBufAllocatorcompositeHeapBuffer 在类中 AbstractByteBufAllocatorpublic CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
ByteBufAllocatorCompositeByteBuf with the given maximum number of components that can be stored in it.compositeDirectBuffer 在接口中 ByteBufAllocatorcompositeDirectBuffer 在类中 AbstractByteBufAllocatorpublic boolean isDirectBufferPooled()
ByteBufAllocatortrue if direct ByteBuf's are pooledisDirectBufferPooled 在接口中 ByteBufAllocatorpublic ByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProviderByteBufAllocatorMetric for a ByteBufAllocator.metric 在接口中 ByteBufAllocatorMetricProvider