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.StampedLock
allocationLock
private java.util.Queue<AdaptivePoolingAllocator.AdaptiveByteBuf>
bufferQueue
private AdaptivePoolingAllocator.Chunk
current
private static ObjectPool<AdaptivePoolingAllocator.AdaptiveByteBuf>
EVENT_LOOP_LOCAL_BUFFER_POOL
private ObjectPool.Handle<AdaptivePoolingAllocator.AdaptiveByteBuf>
handle
private static AdaptivePoolingAllocator.Chunk
MAGAZINE_FREED
private static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<AdaptivePoolingAllocator.Magazine,AdaptivePoolingAllocator.Chunk>
NEXT_IN_LINE
private AdaptivePoolingAllocator.Chunk
nextInLine
private java.util.concurrent.atomic.AtomicLong
usedMemory
-
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 boolean
allocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
private boolean
allocateWithoutLock(int size, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
(package private) void
free()
AdaptivePoolingAllocator.AdaptiveByteBuf
newBuffer()
private AdaptivePoolingAllocator.Chunk
newChunkAllocation(int promptingSize)
private void
restoreMagazineFreed()
private void
transferToNextInLineOrRelease(AdaptivePoolingAllocator.Chunk chunk)
boolean
tryAllocate(int size, int sizeBucket, int maxCapacity, AdaptivePoolingAllocator.AdaptiveByteBuf buf)
(package private) boolean
trySetNextInLine(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()
-
-