Package io.netty.buffer
Class AdaptivePoolingAllocator.Magazine
- java.lang.Object
-
- io.netty.buffer.AdaptivePoolingAllocator.AllocationStatistics
-
- io.netty.buffer.AdaptivePoolingAllocator.Magazine
-
- Enclosing class:
- AdaptivePoolingAllocator
private static final class AdaptivePoolingAllocator.Magazine extends AdaptivePoolingAllocator.AllocationStatistics
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.locks.StampedLockallocationLockprivate java.util.Queue<AdaptivePoolingAllocator.AdaptiveByteBuf>bufferQueueprivate AdaptivePoolingAllocator.Chunkcurrentprivate static ObjectPool<AdaptivePoolingAllocator.AdaptiveByteBuf>EVENT_LOOP_LOCAL_BUFFER_POOLprivate ObjectPool.Handle<AdaptivePoolingAllocator.AdaptiveByteBuf>handleprivate static AdaptivePoolingAllocator.ChunkMAGAZINE_FREEDprivate static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<AdaptivePoolingAllocator.Magazine,AdaptivePoolingAllocator.Chunk>NEXT_IN_LINEprivate AdaptivePoolingAllocator.ChunknextInLineprivate java.util.concurrent.atomic.AtomicLongusedMemory-
Fields inherited from class io.netty.buffer.AdaptivePoolingAllocator.AllocationStatistics
localPrefChunkSize, parent, sharedPrefChunkSize
-
-
Constructor Summary
Constructors Constructor Description Magazine(AdaptivePoolingAllocator parent)Magazine(AdaptivePoolingAllocator parent, boolean shareable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)private booleanallocateWithoutLock(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)(package private) voidfree()AdaptivePoolingAllocator.AdaptiveByteBufnewBuffer()private AdaptivePoolingAllocator.ChunknewChunkAllocation(int promptingSize)private voidrestoreMagazineFreed()private voidtransferToNextInLineOrRelease(AdaptivePoolingAllocator.Chunk chunk)booleantryAllocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)(package private) booleantrySetNextInLine(AdaptivePoolingAllocator.Chunk chunk)-
Methods inherited from class io.netty.buffer.AdaptivePoolingAllocator.AllocationStatistics
preferredChunkSize, recordAllocationSize, sizeBucket
-
-
-
-
Field Detail
-
NEXT_IN_LINE
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<AdaptivePoolingAllocator.Magazine,AdaptivePoolingAllocator.Chunk> NEXT_IN_LINE
-
MAGAZINE_FREED
private static final AdaptivePoolingAllocator.Chunk MAGAZINE_FREED
-
EVENT_LOOP_LOCAL_BUFFER_POOL
private static final ObjectPool<AdaptivePoolingAllocator.AdaptiveByteBuf> EVENT_LOOP_LOCAL_BUFFER_POOL
-
current
private AdaptivePoolingAllocator.Chunk current
-
nextInLine
private volatile AdaptivePoolingAllocator.Chunk nextInLine
-
usedMemory
private final java.util.concurrent.atomic.AtomicLong usedMemory
-
allocationLock
private final java.util.concurrent.locks.StampedLock allocationLock
-
bufferQueue
private final java.util.Queue<AdaptivePoolingAllocator.AdaptiveByteBuf> bufferQueue
-
handle
private final ObjectPool.Handle<AdaptivePoolingAllocator.AdaptiveByteBuf> handle
-
-
Constructor Detail
-
Magazine
Magazine(AdaptivePoolingAllocator parent)
-
Magazine
Magazine(AdaptivePoolingAllocator parent, boolean shareable)
-
-
Method Detail
-
tryAllocate
public boolean tryAllocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
-
allocateWithoutLock
private boolean allocateWithoutLock(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
-
allocate
private boolean allocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
-
restoreMagazineFreed
private void restoreMagazineFreed()
-
transferToNextInLineOrRelease
private void transferToNextInLineOrRelease(AdaptivePoolingAllocator.Chunk chunk)
-
newChunkAllocation
private AdaptivePoolingAllocator.Chunk newChunkAllocation(int promptingSize)
-
trySetNextInLine
boolean trySetNextInLine(AdaptivePoolingAllocator.Chunk chunk)
-
free
void free()
-
newBuffer
public AdaptivePoolingAllocator.AdaptiveByteBuf newBuffer()
-
-