NETTY代码如下
public void bing(int port) throws Exception{
logger.debug("服务器已启动,端口为:"+port);
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup);
b.channel(NioServerSocketChannel.class);
b.option(ChannelOption.SO_BACKLOG, 1024);
b.childHandler(new ChildChannelHandler());
ChannelFuture f = b.bind(port).sync();
f.channel().closeFuture().sync();
} finally{
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
**以上代码,比如现在建立了10个CHANNEL,现在有一个CHANNEL关闭了,执行了 f.channel().closeFuture().sync(); 执行完之后,会不会导致以下代码
finally{
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
立即被执行,而不用等待其余9个CHANNEL的关闭 **