ThreadNameAuditor Class — netty Architecture
Architecture documentation for the ThreadNameAuditor class in LocalTransportThreadModelTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61["ThreadNameAuditor"] adb139e6_2a46_ab0a_b143_d2609be299b3["LocalTransportThreadModelTest.java"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|defined in| adb139e6_2a46_ab0a_b143_d2609be299b3 fa6b352c_d74d_6a29_a24a_5ac4b4140205["ThreadNameAuditor()"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|method| fa6b352c_d74d_6a29_a24a_5ac4b4140205 3ea294c4_dd6f_8b24_cb16_4402e2580196["handlerRemoved()"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|method| 3ea294c4_dd6f_8b24_cb16_4402e2580196 5ea4e278_c514_a36b_6c1c_694d3d15be6d["channelRead()"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|method| 5ea4e278_c514_a36b_6c1c_694d3d15be6d b71fa464_aa34_c554_4b9a_ed67afd8bdcf["write()"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|method| b71fa464_aa34_c554_4b9a_ed67afd8bdcf fa42f72d_994c_3545_03ab_d1f9b8b741e9["exceptionCaught()"] 4a524b14_c3ca_dd13_1dc4_e58c6bcaee61 -->|method| fa42f72d_994c_3545_03ab_d1f9b8b741e9
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest.java lines 368–411
private static class ThreadNameAuditor extends ChannelDuplexHandler {
private final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
private final Queue<String> inboundThreadNames = new ConcurrentLinkedQueue<String>();
private final Queue<String> outboundThreadNames = new ConcurrentLinkedQueue<String>();
private final Queue<String> removalThreadNames = new ConcurrentLinkedQueue<String>();
private final boolean discard;
ThreadNameAuditor() {
this(false);
}
ThreadNameAuditor(boolean discard) {
this.discard = discard;
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
removalThreadNames.add(Thread.currentThread().getName());
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
inboundThreadNames.add(Thread.currentThread().getName());
if (!discard) {
ctx.fireChannelRead(msg);
}
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
outboundThreadNames.add(Thread.currentThread().getName());
ctx.write(msg, promise);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
exception.compareAndSet(null, cause);
System.err.print('[' + Thread.currentThread().getName() + "] ");
cause.printStackTrace();
super.exceptionCaught(ctx, cause);
}
}
Source
Frequently Asked Questions
What is the ThreadNameAuditor class?
ThreadNameAuditor is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest.java.
Where is ThreadNameAuditor defined?
ThreadNameAuditor is defined in transport/src/test/java/io/netty/channel/local/LocalTransportThreadModelTest.java at line 368.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free