ThreadLocalDirectByteBuf Class — netty Architecture
Architecture documentation for the ThreadLocalDirectByteBuf class in ByteBufUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3af531be_852c_d7f9_0595_e937132be83e["ThreadLocalDirectByteBuf"] 373e0ae1_9ed6_8f3b_aa9e_665e0d7416be["ByteBufUtil.java"] 3af531be_852c_d7f9_0595_e937132be83e -->|defined in| 373e0ae1_9ed6_8f3b_aa9e_665e0d7416be c798754d_06be_9b28_4450_e44d51594ff9["ThreadLocalDirectByteBuf()"] 3af531be_852c_d7f9_0595_e937132be83e -->|method| c798754d_06be_9b28_4450_e44d51594ff9 c478af19_45e4_331d_99a3_e531e0dae028["deallocate()"] 3af531be_852c_d7f9_0595_e937132be83e -->|method| c478af19_45e4_331d_99a3_e531e0dae028
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 1736–1767
static final class ThreadLocalDirectByteBuf extends UnpooledDirectByteBuf {
private static final Recycler<ThreadLocalDirectByteBuf> RECYCLER = new Recycler<ThreadLocalDirectByteBuf>() {
@Override
protected ThreadLocalDirectByteBuf newObject(Handle<ThreadLocalDirectByteBuf> handle) {
return new ThreadLocalDirectByteBuf(handle);
}
};
static ThreadLocalDirectByteBuf newInstance() {
ThreadLocalDirectByteBuf buf = RECYCLER.get();
buf.resetRefCnt();
return buf;
}
private final EnhancedHandle<ThreadLocalDirectByteBuf> handle;
private ThreadLocalDirectByteBuf(Handle<ThreadLocalDirectByteBuf> handle) {
super(UnpooledByteBufAllocator.DEFAULT, 256, Integer.MAX_VALUE);
this.handle = (EnhancedHandle<ThreadLocalDirectByteBuf>) handle;
}
@Override
protected void deallocate() {
if (capacity() > THREAD_LOCAL_BUFFER_SIZE) {
super.deallocate();
} else {
clear();
handle.unguardedRecycle(this);
}
}
}
Source
Frequently Asked Questions
What is the ThreadLocalDirectByteBuf class?
ThreadLocalDirectByteBuf is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is ThreadLocalDirectByteBuf defined?
ThreadLocalDirectByteBuf is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 1736.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free