BuddyChunkController Class — netty Architecture
Architecture documentation for the BuddyChunkController class in AdaptivePoolingAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 23afb641_57b1_7630_1fc4_b3b5fbd670a0["BuddyChunkController"] fee3fa6d_a7fb_30d6_ea34_49602c633a2c["AdaptivePoolingAllocator.java"] 23afb641_57b1_7630_1fc4_b3b5fbd670a0 -->|defined in| fee3fa6d_a7fb_30d6_ea34_49602c633a2c 20ecbabc_320e_3380_933e_aba1769a5972["BuddyChunkController()"] 23afb641_57b1_7630_1fc4_b3b5fbd670a0 -->|method| 20ecbabc_320e_3380_933e_aba1769a5972 aa422d6c_b7e6_9e6f_2f40_6c8a846e8ae6["computeBufferCapacity()"] 23afb641_57b1_7630_1fc4_b3b5fbd670a0 -->|method| aa422d6c_b7e6_9e6f_2f40_6c8a846e8ae6 9e6dbf14_26ff_f501_00e5_f05f951e6c99["Chunk()"] 23afb641_57b1_7630_1fc4_b3b5fbd670a0 -->|method| 9e6dbf14_26ff_f501_00e5_f05f951e6c99
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java lines 756–785
private static final class BuddyChunkController implements ChunkController {
private final ChunkAllocator chunkAllocator;
private final ChunkRegistry chunkRegistry;
private final AtomicInteger maxChunkSize;
BuddyChunkController(MagazineGroup group, AtomicInteger maxChunkSize) {
chunkAllocator = group.chunkAllocator;
chunkRegistry = group.allocator.chunkRegistry;
this.maxChunkSize = maxChunkSize;
}
@Override
public int computeBufferCapacity(int requestedSize, int maxCapacity, boolean isReallocation) {
return MathUtil.safeFindNextPositivePowerOfTwo(requestedSize);
}
@Override
public Chunk newChunkAllocation(int promptingSize, Magazine magazine) {
int maxChunkSize = this.maxChunkSize.get();
int proposedChunkSize = MathUtil.safeFindNextPositivePowerOfTwo(BUFS_PER_CHUNK * promptingSize);
int chunkSize = Math.min(MAX_CHUNK_SIZE, Math.max(maxChunkSize, proposedChunkSize));
if (chunkSize > maxChunkSize) {
// Update our stored max chunk size. It's fine that this is racy.
this.maxChunkSize.set(chunkSize);
}
BuddyChunk chunk = new BuddyChunk(chunkAllocator.allocate(chunkSize, chunkSize), magazine);
chunkRegistry.add(chunk);
return chunk;
}
}
Source
Frequently Asked Questions
What is the BuddyChunkController class?
BuddyChunkController is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java.
Where is BuddyChunkController defined?
BuddyChunkController is defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java at line 756.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free