public final class UnpooledByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider
ByteBufAllocator
implementation that does not pool anything.Modifier and Type | Field and Description |
---|---|
static UnpooledByteBufAllocator |
DEFAULT
Default instance which uses leak-detection for direct buffers.
|
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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, toString
public 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)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newHeapBuffer
in class AbstractByteBufAllocator
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newDirectBuffer
in class AbstractByteBufAllocator
public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
ByteBufAllocator
CompositeByteBuf
with the given maximum number of components that can be stored in it.compositeHeapBuffer
in interface ByteBufAllocator
compositeHeapBuffer
in class AbstractByteBufAllocator
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
ByteBufAllocator
CompositeByteBuf
with the given maximum number of components that can be stored in it.compositeDirectBuffer
in interface ByteBufAllocator
compositeDirectBuffer
in class AbstractByteBufAllocator
public boolean isDirectBufferPooled()
ByteBufAllocator
true
if direct ByteBuf
's are pooledisDirectBufferPooled
in interface ByteBufAllocator
public ByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProvider
ByteBufAllocatorMetric
for a ByteBufAllocator
.metric
in interface ByteBufAllocatorMetricProvider
Copyright © 2008–2024 The Netty Project. All rights reserved.