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 int
private final AdaptivePoolingAllocator
private final int
private final AbstractByteBuf
private final boolean
private int
private static final long
private static final ReferenceCountUpdater
<AdaptivePoolingAllocator.Chunk> -
Constructor Summary
ConstructorsConstructorDescriptionChunk()
Chunk
(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine, boolean pooled) -
Method Summary
Modifier and TypeMethodDescription(package private) void
int
capacity()
(package private) AdaptivePoolingAllocator.Magazine
private void
(package private) void
void
readInitInto
(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int maxCapacity) int
refCnt()
Returns the reference count of this object.boolean
release()
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.boolean
release
(int decrement) Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.int
retain()
Increases the reference count by1
.retain
(int increment) Increases the reference count by the specifiedincrement
.private static boolean
shouldReleaseSuboptimalChunkSuze
(int givenSize, int preferredSize) 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
-
allocator
-
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
-
currentMagazine
AdaptivePoolingAllocator.Magazine currentMagazine() -
detachFromMagazine
void detachFromMagazine() -
attachToMagazine
-
touch
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceReferenceCounted
-
refCnt
public int refCnt()Description copied from interface:ReferenceCounted
Returns the reference count of this object. If0
, it means this object has been deallocated.- Specified by:
refCnt
in interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceReferenceCounted
-
release
public boolean release()Description copied from interface:ReferenceCounted
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
release
public boolean release(int decrement) Description copied from interface:ReferenceCounted
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
deallocate
private void deallocate() -
shouldReleaseSuboptimalChunkSuze
private static boolean shouldReleaseSuboptimalChunkSuze(int givenSize, int preferredSize) -
readInitInto
-
remainingCapacity
public int remainingCapacity() -
capacity
public int capacity()
-