Call IOUringEventLoopGroup.shutdownGracefully() after test is done.
This commit is contained in:
parent
5691fe8a44
commit
e1c6f111f5
@ -8,6 +8,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
|
|||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
|
import io.netty.channel.socket.ServerSocketChannel;
|
||||||
import io.netty.channel.socket.SocketChannel;
|
import io.netty.channel.socket.SocketChannel;
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
@ -24,7 +25,7 @@ public class PollRemoveTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Sharable
|
@Sharable
|
||||||
class EchoUringServerHandler extends ChannelInboundHandlerAdapter {
|
private static final class EchoUringServerHandler extends ChannelInboundHandlerAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
public void channelRead(ChannelHandlerContext ctx, Object msg) {
|
||||||
@ -46,11 +47,11 @@ public class PollRemoveTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void io_uring_test() throws Exception {
|
void io_uring_test() throws Exception {
|
||||||
Class clazz;
|
Class<? extends ServerSocketChannel> clazz = IOUringServerSocketChannel.class;
|
||||||
final EventLoopGroup bossGroup = new IOUringEventLoopGroup(1);
|
final EventLoopGroup bossGroup = new IOUringEventLoopGroup(1);
|
||||||
final EventLoopGroup workerGroup = new IOUringEventLoopGroup(1);
|
final EventLoopGroup workerGroup = new IOUringEventLoopGroup(1);
|
||||||
clazz = IOUringServerSocketChannel.class;
|
|
||||||
|
|
||||||
|
try {
|
||||||
ServerBootstrap b = new ServerBootstrap();
|
ServerBootstrap b = new ServerBootstrap();
|
||||||
b.group(bossGroup, workerGroup)
|
b.group(bossGroup, workerGroup)
|
||||||
.channel(clazz)
|
.channel(clazz)
|
||||||
@ -67,8 +68,12 @@ public class PollRemoveTest {
|
|||||||
Channel sc = b.bind(2020).sync().channel();
|
Channel sc = b.bind(2020).sync().channel();
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
||||||
//close ServerChannel
|
// close ServerChannel
|
||||||
sc.close().sync();
|
sc.close().sync();
|
||||||
|
} finally {
|
||||||
|
bossGroup.shutdownGracefully();
|
||||||
|
workerGroup.shutdownGracefully();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user