Package io.netty.buffer
Class AdaptiveByteBufAllocator
- java.lang.Object
-
- io.netty.buffer.AbstractByteBufAllocator
-
- io.netty.buffer.AdaptiveByteBufAllocator
-
- All Implemented Interfaces:
ByteBufAllocator,ByteBufAllocatorMetric,ByteBufAllocatorMetricProvider
@UnstableApi public final class AdaptiveByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider, ByteBufAllocatorMetric
An auto-tuning poolingByteBufAllocator, 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
AdaptivePoolingAllocatorclass documentation for implementation details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceAdaptiveByteBufAllocator.AdaptiveAllocatorApiprivate static classAdaptiveByteBufAllocator.DirectChunkAllocatorprivate static classAdaptiveByteBufAllocator.HeapChunkAllocator
-
Field Summary
Fields Modifier and Type Field Description private static booleanDEFAULT_USE_CACHED_MAGAZINES_FOR_NON_EVENT_LOOP_THREADSprivate AdaptiveByteBufAllocator.AdaptiveAllocatorApidirectprivate AdaptiveByteBufAllocator.AdaptiveAllocatorApiheapprivate static InternalLoggerlogger-
Fields inherited from class io.netty.buffer.AbstractByteBufAllocator
CALCULATE_THRESHOLD, DEFAULT_INITIAL_CAPACITY, DEFAULT_MAX_CAPACITY, DEFAULT_MAX_COMPONENTS
-
Fields inherited from interface io.netty.buffer.ByteBufAllocator
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description AdaptiveByteBufAllocator()AdaptiveByteBufAllocator(boolean preferDirect)AdaptiveByteBufAllocator(boolean preferDirect, boolean useCacheForNonEventLoopThreads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisDirectBufferPooled()Returnstrueif directByteBuf's are pooledByteBufAllocatorMetricmetric()Returns aByteBufAllocatorMetricfor aByteBufAllocator.protected ByteBufnewDirectBuffer(int initialCapacity, int maxCapacity)Create a directByteBufwith the given initialCapacity and maxCapacity.protected ByteBufnewHeapBuffer(int initialCapacity, int maxCapacity)Create a heapByteBufwith the given initialCapacity and maxCapacity.longusedDirectMemory()Returns the number of bytes of direct memory used by aByteBufAllocatoror-1if unknown.longusedHeapMemory()Returns the number of bytes of heap memory used by aByteBufAllocatoror-1if unknown.-
Methods inherited from class io.netty.buffer.AbstractByteBufAllocator
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, compositeHeapBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toString
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
DEFAULT_USE_CACHED_MAGAZINES_FOR_NON_EVENT_LOOP_THREADS
private static final boolean DEFAULT_USE_CACHED_MAGAZINES_FOR_NON_EVENT_LOOP_THREADS
-
direct
private final AdaptiveByteBufAllocator.AdaptiveAllocatorApi direct
-
heap
private final AdaptiveByteBufAllocator.AdaptiveAllocatorApi heap
-
-
Method Detail
-
newHeapBuffer
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
Description copied from class:AbstractByteBufAllocatorCreate a heapByteBufwith the given initialCapacity and maxCapacity.- Specified by:
newHeapBufferin classAbstractByteBufAllocator
-
newDirectBuffer
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
Description copied from class:AbstractByteBufAllocatorCreate a directByteBufwith the given initialCapacity and maxCapacity.- Specified by:
newDirectBufferin classAbstractByteBufAllocator
-
isDirectBufferPooled
public boolean isDirectBufferPooled()
Description copied from interface:ByteBufAllocatorReturnstrueif directByteBuf's are pooled- Specified by:
isDirectBufferPooledin interfaceByteBufAllocator
-
usedHeapMemory
public long usedHeapMemory()
Description copied from interface:ByteBufAllocatorMetricReturns the number of bytes of heap memory used by aByteBufAllocatoror-1if unknown.- Specified by:
usedHeapMemoryin interfaceByteBufAllocatorMetric
-
usedDirectMemory
public long usedDirectMemory()
Description copied from interface:ByteBufAllocatorMetricReturns the number of bytes of direct memory used by aByteBufAllocatoror-1if unknown.- Specified by:
usedDirectMemoryin interfaceByteBufAllocatorMetric
-
metric
public ByteBufAllocatorMetric metric()
Description copied from interface:ByteBufAllocatorMetricProviderReturns aByteBufAllocatorMetricfor aByteBufAllocator.- Specified by:
metricin interfaceByteBufAllocatorMetricProvider
-
-