Package io.netty.buffer
Class AdaptivePoolingAllocator.Chunk
- java.lang.Object
-
- io.netty.buffer.AdaptivePoolingAllocator.Chunk
-
- All Implemented Interfaces:
ChunkInfo
- Direct Known Subclasses:
AdaptivePoolingAllocator.BuddyChunk,AdaptivePoolingAllocator.SizeClassedChunk
- Enclosing class:
- AdaptivePoolingAllocator
static class AdaptivePoolingAllocator.Chunk extends java.lang.Object implements ChunkInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected intallocatedBytesprivate AdaptivePoolingAllocatorallocatorprivate intcapacityprotected AbstractByteBufdelegateprotected AdaptivePoolingAllocator.Magazinemagazineprivate booleanpooledprivate RefCntrefCnt
-
Constructor Summary
Constructors Constructor Description Chunk()Chunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine, boolean pooled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidattachToMagazine(AdaptivePoolingAllocator.Magazine magazine)intcapacity()The capacity of the chunk, in bytes.(package private) AdaptivePoolingAllocator.MagazinecurrentMagazine()protected voiddeallocate()(package private) voiddetachFromMagazine()booleanhasUnprocessedFreelistEntries()booleanisDirect()trueif the chunk contain native memory, otherwisefalse.(package private) voidmarkToDeallocate()longmemoryAddress()The native memory address of the chunk, if any, otherwise zero.private voidonRelease()voidprocessFreelistEntries()booleanreadInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int startingCapacity, int maxCapacity)protected booleanrelease()(package private) voidreleaseFromMagazine()Called when a magazine is done using this chunk, probably because it was emptied.(package private) voidreleaseSegment(int ignoredSegmentId, int size)Called when a ByteBuf is done using its allocation in this chunk.intremainingCapacity()private voidretain()
-
-
-
Field Detail
-
delegate
protected final AbstractByteBuf delegate
-
magazine
protected AdaptivePoolingAllocator.Magazine magazine
-
allocator
private final AdaptivePoolingAllocator allocator
-
refCnt
private final RefCnt refCnt
-
capacity
private final int capacity
-
pooled
private final boolean pooled
-
allocatedBytes
protected int allocatedBytes
-
-
Constructor Detail
-
Chunk
Chunk()
-
Chunk
Chunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine, boolean pooled)
-
-
Method Detail
-
currentMagazine
AdaptivePoolingAllocator.Magazine currentMagazine()
-
detachFromMagazine
void detachFromMagazine()
-
attachToMagazine
void attachToMagazine(AdaptivePoolingAllocator.Magazine magazine)
-
releaseFromMagazine
void releaseFromMagazine()
Called when a magazine is done using this chunk, probably because it was emptied.
-
releaseSegment
void releaseSegment(int ignoredSegmentId, int size)Called when a ByteBuf is done using its allocation in this chunk.
-
markToDeallocate
void markToDeallocate()
-
retain
private void retain()
-
release
protected boolean release()
-
deallocate
protected void deallocate()
-
onRelease
private void onRelease()
-
readInitInto
public boolean readInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int startingCapacity, int maxCapacity)
-
remainingCapacity
public int remainingCapacity()
-
hasUnprocessedFreelistEntries
public boolean hasUnprocessedFreelistEntries()
-
processFreelistEntries
public void processFreelistEntries()
-
capacity
public int capacity()
Description copied from interface:ChunkInfoThe capacity of the chunk, in bytes.
-
isDirect
public boolean isDirect()
Description copied from interface:ChunkInfotrueif the chunk contain native memory, otherwisefalse.
-
memoryAddress
public long memoryAddress()
Description copied from interface:ChunkInfoThe native memory address of the chunk, if any, otherwise zero.- Specified by:
memoryAddressin interfaceChunkInfo
-
-