diff --git a/common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java b/common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java index 1b22196ba9..5f14782e02 100644 --- a/common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java +++ b/common/src/main/java/org/apache/uniffle/common/rpc/GrpcServer.java @@ -41,12 +41,13 @@ public class GrpcServer implements ServerInterface { private final Server server; private final int port; + private final ExecutorService pool; public GrpcServer(RssBaseConf conf, BindableService service, GRPCMetrics grpcMetrics) { this.port = conf.getInteger(RssBaseConf.RPC_SERVER_PORT); long maxInboundMessageSize = conf.getLong(RssBaseConf.RPC_MESSAGE_MAX_SIZE); int rpcExecutorSize = conf.getInteger(RssBaseConf.RPC_EXECUTOR_SIZE); - ExecutorService pool = new ThreadPoolExecutor( + pool = new ThreadPoolExecutor( rpcExecutorSize, rpcExecutorSize * 2, 10, @@ -89,6 +90,9 @@ public void stop() throws InterruptedException { server.shutdown().awaitTermination(10, TimeUnit.SECONDS); LOG.info("GRPC server stopped!"); } + if (pool != null) { + pool.shutdown(); + } } public void blockUntilShutdown() throws InterruptedException {