perf[net]: 把优雅关闭线程池的日志打印的更加详细

This commit is contained in:
godotg committed 2022-08-23 16:47:06 +08:00
1 parent 77ba9c0ee8
commit 36f895d279
3 files changed
+28 -6

No files matched your search

@@ -18,6 +18,7 @@ import com.zfoo.net.handler.BaseRouteHandler;
import com.zfoo.net.session.model.Session;
import com.zfoo.protocol.exception.ExceptionUtils;
import com.zfoo.protocol.util.IOUtils;
import com.zfoo.util.ThreadUtils;
import com.zfoo.util.net.HostAndPort;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
@@ -87,7 +88,7 @@ public abstract class AbstractClient implements IClient {
public synchronized static void shutdown() {
AbstractServer.shutdownEventLoopGracefully(nioEventLoopGroup);
ThreadUtils.shutdownEventLoopGracefully("netty-client", nioEventLoopGroup);
}
}
@@ -14,6 +14,7 @@
package com.zfoo.net.core;
import com.zfoo.protocol.util.IOUtils;
import com.zfoo.util.ThreadUtils;
import com.zfoo.util.net.HostAndPort;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
@@ -103,9 +104,8 @@ public abstract class AbstractServer implements IServer {
@Override
public synchronized void shutdown() {
shutdownEventLoopGracefully(bossGroup);
shutdownEventLoopGracefully(workerGroup);
ThreadUtils.shutdownEventLoopGracefully("netty-boss", bossGroup);
ThreadUtils.shutdownEventLoopGracefully("netty-worker", workerGroup);
if (channelFuture != null) {
try {
@@ -136,7 +136,7 @@ public abstract class AbstractServer implements IServer {
logger.error("EventLoop Thread pool [{}] is failed to shutdown! ", executor, e);
return;
}
logger.info("EventLoop Thread pool [{}] shuts down gracefully.", executor);
logger.info("EventLoop Thread pool [{}] shutdown gracefully.", executor);
}
public synchronized static void shutdownAllServers() {