Package io.netty.buffer
Class AdaptivePoolingAllocator.Magazine
- java.lang.Object
-
- io.netty.buffer.AdaptivePoolingAllocator.Magazine
-
- Enclosing class:
- AdaptivePoolingAllocator
private static final class AdaptivePoolingAllocator.Magazine extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.locks.StampedLockallocationLockprivate java.util.Queue<AdaptivePoolingAllocator.AdaptiveByteBuf>bufferQueueprivate AdaptivePoolingAllocator.ChunkControllerchunkControllerprivate AdaptivePoolingAllocator.Chunkcurrentprivate static ObjectPool<AdaptivePoolingAllocator.AdaptiveByteBuf>EVENT_LOOP_LOCAL_BUFFER_POOLprivate AdaptivePoolingAllocator.MagazineGroupgroupprivate 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.Queue<AdaptivePoolingAllocator.Chunk>sharedChunkQueue
-
Constructor Summary
Constructors Constructor Description Magazine(AdaptivePoolingAllocator.MagazineGroup group, boolean shareable, java.util.Queue<AdaptivePoolingAllocator.Chunk> sharedChunkQueue, AdaptivePoolingAllocator.ChunkController chunkController)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallocate(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf, boolean reallocate)private booleanallocateWithoutLock(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)(package private) voidfree()voidinitializeSharedStateIn(AdaptivePoolingAllocator.Magazine other)AdaptivePoolingAllocator.AdaptiveByteBufnewBuffer()(package private) booleanofferToQueue(AdaptivePoolingAllocator.Chunk chunk)private voidrestoreMagazineFreed()private voidtransferToNextInLineOrRelease(AdaptivePoolingAllocator.Chunk chunk)booleantryAllocate(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf, boolean reallocate)(package private) booleantrySetNextInLine(AdaptivePoolingAllocator.Chunk chunk)
-
-
-
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
-
group
private final AdaptivePoolingAllocator.MagazineGroup group
-
chunkController
private final AdaptivePoolingAllocator.ChunkController chunkController
-
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
-
sharedChunkQueue
private final java.util.Queue<AdaptivePoolingAllocator.Chunk> sharedChunkQueue
-
-
Constructor Detail
-
Magazine
Magazine(AdaptivePoolingAllocator.MagazineGroup group, boolean shareable, java.util.Queue<AdaptivePoolingAllocator.Chunk> sharedChunkQueue, AdaptivePoolingAllocator.ChunkController chunkController)
-
-
Method Detail
-
tryAllocate
public boolean tryAllocate(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf, boolean reallocate)
-
allocateWithoutLock
private boolean allocateWithoutLock(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
-
allocate
private boolean allocate(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf, boolean reallocate)
-
restoreMagazineFreed
private void restoreMagazineFreed()
-
transferToNextInLineOrRelease
private void transferToNextInLineOrRelease(AdaptivePoolingAllocator.Chunk chunk)
-
trySetNextInLine
boolean trySetNextInLine(AdaptivePoolingAllocator.Chunk chunk)
-
free
void free()
-
newBuffer
public AdaptivePoolingAllocator.AdaptiveByteBuf newBuffer()
-
offerToQueue
boolean offerToQueue(AdaptivePoolingAllocator.Chunk chunk)
-
initializeSharedStateIn
public void initializeSharedStateIn(AdaptivePoolingAllocator.Magazine other)
-
-