ChannelFuture closeFuture = channelFuture.channel().closeFuture() 中的closeFuture与调用Channel的close()方法时,Netty返回的CloseFuture对象 是什么关系
相关代码
try {
// 7 监听通道关闭事件
// 应用程序会一直等待,直到channel关闭
ChannelFuture closeFuture = channelFuture.channel().closeFuture() ;
closeFuture.sync() ;
} catch (Exception e) {
e.printStackTrace() ;
log.error("发生其他异常", e) ;
} finally {
// 8 优雅关闭EventLoopGroup,
// 释放掉所有资源包括创建的线程****
bossGroup.shutdownGracefully() ;
workGroup.shutdownGracefully() ;
}