offerChunk() — netty Function Reference
Architecture documentation for the offerChunk() function in AdaptivePoolingAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8581bfb7_29e0_ba76_9f0e_87d86c459049["offerChunk()"] ce074796_a915_3e8e_0b02_6bb0f820ea3e["ConcurrentSkipListChunkCache"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|defined in| ce074796_a915_3e8e_0b02_6bb0f820ea3e 41230d9d_3792_e2cb_6bf6_5576bee2a05f["size()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| 41230d9d_3792_e2cb_6bf6_5576bee2a05f 2b1d13b5_b5b9_8db8_baa4_b5edd12f88d0["remove()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| 2b1d13b5_b5b9_8db8_baa4_b5edd12f88d0 59c1d0ae_e507_0c96_51fa_359fe1b6411f["release()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| 59c1d0ae_e507_0c96_51fa_359fe1b6411f feca76a1_135e_83be_6297_3ca41c7e00bd["offerChunk()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| feca76a1_135e_83be_6297_3ca41c7e00bd 0d87a4f6_817c_89dc_baee_630435215d14["capacity()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| 0d87a4f6_817c_89dc_baee_630435215d14 aa355cc9_0be7_7204_fd7f_51edca001d83["remainingCapacity()"] 8581bfb7_29e0_ba76_9f0e_87d86c459049 -->|calls| aa355cc9_0be7_7204_fd7f_51edca001d83 style 8581bfb7_29e0_ba76_9f0e_87d86c459049 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java lines 605–641
@Override
public boolean offerChunk(Chunk chunk) {
chunks.put(chunk.remainingCapacity(), chunk);
int size = chunks.size();
while (size > CHUNK_REUSE_QUEUE) {
// Deallocate the chunk with the fewest incoming references.
int key = -1;
Chunk toDeallocate = null;
for (IntEntry<Chunk> entry : chunks) {
Chunk candidate = entry.getValue();
if (candidate != null) {
if (toDeallocate == null) {
toDeallocate = candidate;
key = entry.getKey();
} else {
int candidateRefCnt = RefCnt.refCnt(candidate.refCnt);
int toDeallocateRefCnt = RefCnt.refCnt(toDeallocate.refCnt);
if (candidateRefCnt < toDeallocateRefCnt ||
candidateRefCnt == toDeallocateRefCnt &&
candidate.capacity() < toDeallocate.capacity()) {
toDeallocate = candidate;
key = entry.getKey();
}
}
}
}
if (toDeallocate == null) {
break;
}
if (chunks.remove(key, toDeallocate)) {
toDeallocate.release();
}
size = chunks.size();
}
return true;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does offerChunk() do?
offerChunk() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java.
Where is offerChunk() defined?
offerChunk() is defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java at line 605.
What does offerChunk() call?
offerChunk() calls 6 function(s): capacity, offerChunk, release, remainingCapacity, remove, size.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free