ReRegisterHandler Class — netty Architecture
Architecture documentation for the ReRegisterHandler class in AbstractEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3cd79522_6bee_9112_a872_451fa97e98c4["ReRegisterHandler"] a5eb7fa0_98bd_e7d0_453c_7bba36c9f4b6["AbstractEventLoopTest.java"] 3cd79522_6bee_9112_a872_451fa97e98c4 -->|defined in| a5eb7fa0_98bd_e7d0_453c_7bba36c9f4b6 07133110_1a0d_23e0_c935_1c3ffb531c17["ReRegisterHandler()"] 3cd79522_6bee_9112_a872_451fa97e98c4 -->|method| 07133110_1a0d_23e0_c935_1c3ffb531c17 43a67bbf_0f1e_6cd2_0e3d_02e9aa298c9d["exceptionCaught()"] 3cd79522_6bee_9112_a872_451fa97e98c4 -->|method| 43a67bbf_0f1e_6cd2_0e3d_02e9aa298c9d fd4cb239_0079_4349_2f0a_6fdb29ae051d["channelRead()"] 3cd79522_6bee_9112_a872_451fa97e98c4 -->|method| fd4cb239_0079_4349_2f0a_6fdb29ae051d 15313de6_ab1d_4576_6b8e_b506ebf37540["EventLoop()"] 3cd79522_6bee_9112_a872_451fa97e98c4 -->|method| 15313de6_ab1d_4576_6b8e_b506ebf37540
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java lines 164–213
@ChannelHandler.Sharable
static class ReRegisterHandler extends ChannelInboundHandlerAdapter {
final EventLoopGroup eventLoopGroup;
private final DeregisterMethod method;
private final AtomicReference<Throwable> throwable;
ReRegisterHandler(EventLoopGroup eventLoopGroup,
DeregisterMethod method,
AtomicReference<Throwable> throwable) {
this.eventLoopGroup = eventLoopGroup;
this.method = method;
this.throwable = throwable;
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
super.exceptionCaught(ctx, cause);
throwable.set(cause);
ctx.close();
}
@Override
public void channelRead(ChannelHandlerContext outCtx, Object msg) throws Exception {
final EventLoop newLoop = anyNotEqual(outCtx.channel().eventLoop());
ChannelFutureListener pipelieModifyingListener = register -> {
outCtx.pipeline().addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext inCtx, Object inMsg) {
outCtx.writeAndFlush(inMsg);
}
});
outCtx.fireChannelRead(msg);
};
ChannelFutureListener reregisteringListener = deregister -> {
deregister.channel().pipeline().fireUserEventTriggered("Unregistered user event");
newLoop.register(deregister.channel()).addListener(pipelieModifyingListener);
};
method.apply(outCtx).addListener(reregisteringListener);
}
private EventLoop anyNotEqual(EventLoop eventLoop) {
EventLoop next;
do {
next = eventLoopGroup.next();
} while (eventLoop == next);
return next;
}
}
Source
Frequently Asked Questions
What is the ReRegisterHandler class?
ReRegisterHandler is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java.
Where is ReRegisterHandler defined?
ReRegisterHandler is defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java at line 164.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free