关闭死锁

back_recharge
zhangshanxue 2019-12-17 11:40:17 +08:00
parent db90677dcd
commit 915f3ea59a
1 changed files with 2 additions and 4 deletions

View File

@ -90,11 +90,11 @@ public class NettyGameServer extends AbstractServer {
ChannelFuture channelFuture = serverBootstrap.bind(getLocalAddress().getPort()).sync();
this.channel = channelFuture.channel();
//同步关闭改异步回调 优雅关闭netty
this.channel.closeFuture().addListener((ChannelFutureListener) future -> close());
this.channel.closeFuture().addListener((ChannelFutureListener) future -> LOGGER.info("netty shutdown completed"));
} catch (Exception e) {
close();
throw new ConnectException("close exception", getLocalAddress(), null);
} finally {
// close();
}
}
@ -136,10 +136,8 @@ public class NettyGameServer extends AbstractServer {
} catch (Throwable var2) {
LOGGER.error("close NettyChannel exception" + var2);
}
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
} catch (Exception e) {
LOGGER.error("close exception", getLocalAddress());
}