Package io.netty.buffer
Class AdaptivePoolingAllocator.Chunk
java.lang.Object
io.netty.buffer.AdaptivePoolingAllocator.Chunk
- All Implemented Interfaces:
ReferenceCounted
- Enclosing class:
AdaptivePoolingAllocator
private static final class AdaptivePoolingAllocator.Chunk
extends Object
implements ReferenceCounted
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AtomicIntegerFieldUpdater<AdaptivePoolingAllocator.Chunk> private intprivate final intprivate final AbstractByteBufprivate final AdaptivePoolingAllocator.Magazineprivate final booleanprivate intprivate static final longprivate static final ReferenceCountUpdater<AdaptivePoolingAllocator.Chunk> -
Constructor Summary
ConstructorsConstructorDescriptionChunk()Chunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine, boolean pooled) -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()private voidvoidreadInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int maxCapacity) intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement) Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.intretain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.touch()Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.
-
Field Details
-
delegate
-
magazine
-
capacity
private final int capacity -
pooled
private final boolean pooled -
allocatedBytes
private int allocatedBytes -
REFCNT_FIELD_OFFSET
private static final long REFCNT_FIELD_OFFSET -
AIF_UPDATER
-
updater
-
refCnt
private volatile int refCnt
-
-
Constructor Details
-
Chunk
Chunk() -
Chunk
Chunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine, boolean pooled)
-
-
Method Details
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector.- Specified by:
touchin interfaceReferenceCounted
-
refCnt
public int refCnt()Description copied from interface:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector. This method is a shortcut totouch(null).- Specified by:
touchin interfaceReferenceCounted
-
release
public boolean release()Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement) Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
deallocate
private void deallocate() -
readInitInto
-
remainingCapacity
public int remainingCapacity() -
capacity
public int capacity()
-