Call IOUringEventLoopGroup.shutdownGracefully() after test is done.

This commit is contained in:
Norman Maurer 2020-09-03 09:47:36 +02:00
parent 5691fe8a44
commit e1c6f111f5

View File

@ -8,6 +8,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
@ -24,7 +25,7 @@ public class PollRemoveTest {
}
@Sharable
class EchoUringServerHandler extends ChannelInboundHandlerAdapter {
private static final class EchoUringServerHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
@ -46,11 +47,11 @@ public class PollRemoveTest {
}
void io_uring_test() throws Exception {
Class clazz;
Class<? extends ServerSocketChannel> clazz = IOUringServerSocketChannel.class;
final EventLoopGroup bossGroup = new IOUringEventLoopGroup(1);
final EventLoopGroup workerGroup = new IOUringEventLoopGroup(1);
clazz = IOUringServerSocketChannel.class;
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(clazz)
@ -69,6 +70,10 @@ public class PollRemoveTest {
// close ServerChannel
sc.close().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}