AbstractEventLoopTest Class — netty Architecture
Architecture documentation for the AbstractEventLoopTest class in AbstractEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3af4ae7a_14bb_5400_5cb6_2dab6e677f86["AbstractEventLoopTest"] a5eb7fa0_98bd_e7d0_453c_7bba36c9f4b6["AbstractEventLoopTest.java"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|defined in| a5eb7fa0_98bd_e7d0_453c_7bba36c9f4b6 088487ae_7824_b92a_7a26_386bbaf0c2b1["testReregister()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| 088487ae_7824_b92a_7a26_386bbaf0c2b1 a9154bc0_2e31_08b0_6b9a_230dfe452c5a["testReregisterOnChannelHandlerContext()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| a9154bc0_2e31_08b0_6b9a_230dfe452c5a c2593d9b_6cfc_4e75_5ab0_c14dccee4fc9["testShutdownGracefullyNoQuietPeriod()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| c2593d9b_6cfc_4e75_5ab0_c14dccee4fc9 e289193d_386b_1e21_eebb_bcf2f6c65a20["EventLoopGroup()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| e289193d_386b_1e21_eebb_bcf2f6c65a20 ad9b962d_d7d4_34f1_3b1e_3c74ab939d1b["newChannel()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| ad9b962d_d7d4_34f1_3b1e_3c74ab939d1b 28f4a349_e732_db11_a40a_21f89f5ee272["newSocketChannel()"] 3af4ae7a_14bb_5400_5cb6_2dab6e677f86 -->|method| 28f4a349_e732_db11_a40a_21f89f5ee272
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java lines 40–244
public abstract class AbstractEventLoopTest {
/**
* Test for https://github.com/netty/netty/issues/803
*/
@Test
public void testReregister() {
EventLoopGroup group = newEventLoopGroup();
EventLoopGroup group2 = newEventLoopGroup();
final EventExecutorGroup eventExecutorGroup = new DefaultEventExecutorGroup(2);
ServerBootstrap bootstrap = new ServerBootstrap();
ChannelFuture future = bootstrap.channel(newChannel()).group(group)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) {
}
}).handler(new ChannelInitializer<ServerSocketChannel>() {
@Override
public void initChannel(ServerSocketChannel ch) {
ch.pipeline().addLast(new TestChannelHandler());
ch.pipeline().addLast(eventExecutorGroup, new TestChannelHandler2());
}
})
.bind(0).awaitUninterruptibly();
EventExecutor executor = future.channel().pipeline().context(TestChannelHandler2.class).executor();
EventExecutor executor1 = future.channel().pipeline().context(TestChannelHandler.class).executor();
future.channel().deregister().awaitUninterruptibly();
Channel channel = group2.register(future.channel()).awaitUninterruptibly().channel();
EventExecutor executorNew = channel.pipeline().context(TestChannelHandler.class).executor();
assertNotSame(executor1, executorNew);
assertSame(executor, future.channel().pipeline().context(TestChannelHandler2.class).executor());
}
/**
* Test for https://github.com/netty/netty/issues/14923
*/
@ParameterizedTest
@EnumSource(DeregisterMethod.class)
void testReregisterOnChannelHandlerContext(DeregisterMethod method) throws Exception {
EventLoopGroup group = newEventLoopGroup();
AtomicReference<Throwable> throwable = new AtomicReference<>();
try {
ServerBootstrap b = new ServerBootstrap();
ReRegisterHandler reRegisterHandler = new ReRegisterHandler(group, method, throwable);
b.group(group)
.channel(newChannel())
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
p.addLast("logging", new LoggingHandler());
p.addLast(reRegisterHandler);
}
});
ChannelFuture f = b.bind(0).sync();
Channel client = new Bootstrap()
.group(group)
.channel(newSocketChannel())
.handler(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ReferenceCountUtil.release(msg);
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
super.channelReadComplete(ctx);
ctx.close();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
throwable.set(cause);
super.exceptionCaught(ctx, cause);
ctx.close();
}
})
Source
Frequently Asked Questions
What is the AbstractEventLoopTest class?
AbstractEventLoopTest is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java.
Where is AbstractEventLoopTest defined?
AbstractEventLoopTest is defined in transport/src/test/java/io/netty/channel/AbstractEventLoopTest.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free