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