@UnstableApi public final class AdaptiveByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider, ByteBufAllocatorMetric
ByteBufAllocator
, that follows an anti-generational hypothesis.
Note: this allocator is experimental. It is recommended to roll out usage slowly, and to carefully monitor application performance in the process.
See the AdaptivePoolingAllocator
class documentation for implementation details.
DEFAULT
Constructor and Description |
---|
AdaptiveByteBufAllocator() |
AdaptiveByteBufAllocator(boolean preferDirect) |
AdaptiveByteBufAllocator(boolean preferDirect,
boolean useCacheForNonEventLoopThreads) |
Modifier and Type | Method and Description |
---|---|
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. |
long |
usedDirectMemory()
Returns the number of bytes of direct memory used by a
ByteBufAllocator or -1 if unknown. |
long |
usedHeapMemory()
Returns the number of bytes of heap memory used by a
ByteBufAllocator or -1 if unknown. |
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, compositeHeapBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toString
public AdaptiveByteBufAllocator()
public AdaptiveByteBufAllocator(boolean preferDirect)
public AdaptiveByteBufAllocator(boolean preferDirect, boolean useCacheForNonEventLoopThreads)
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 boolean isDirectBufferPooled()
ByteBufAllocator
true
if direct ByteBuf
's are pooledisDirectBufferPooled
in interface ByteBufAllocator
public long usedHeapMemory()
ByteBufAllocatorMetric
ByteBufAllocator
or -1
if unknown.usedHeapMemory
in interface ByteBufAllocatorMetric
public long usedDirectMemory()
ByteBufAllocatorMetric
ByteBufAllocator
or -1
if unknown.usedDirectMemory
in interface ByteBufAllocatorMetric
public ByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProvider
ByteBufAllocatorMetric
for a ByteBufAllocator
.metric
in interface ByteBufAllocatorMetricProvider
Copyright © 2008–2024 The Netty Project. All rights reserved.