Merge pull request #27 from normanmaurer/close_group

Call IOUringEventLoopGroup.shutdownGracefully() after test is done.
This commit is contained in:
Josef Grieb 2020-09-03 10:15:12 +02:00 committed by GitHub
commit a55313ed75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
@ -67,8 +68,12 @@ public class PollRemoveTest {
Channel sc = b.bind(2020).sync().channel();
Thread.sleep(1500);
//close ServerChannel
// close ServerChannel
sc.close().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}