From 98c6355079c8d5b4540b14a8109ae3fd56bfe919 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 15 May 2015 18:10:25 -0700 Subject: [PATCH] Disable Netty eventloop graceful termination When shutting down the Netty event loop, we have already guaranteed that all users of it are no longer running. Doing a shutdownGracefully is just delaying graceful JVM termination by two seconds. This is very noticeable for short-lived processes, like our integration tests. We would actually also prefer to shutdown quickly and get a RejectedExecutionException for any newly queued tasks, because that would be a legitimate bug. shutdown() is deprecated, thus we do shutdownGracefully with a timeout of 0. --- netty/src/main/java/io/grpc/transport/netty/Utils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netty/src/main/java/io/grpc/transport/netty/Utils.java b/netty/src/main/java/io/grpc/transport/netty/Utils.java index e85249614e..27b2d62896 100644 --- a/netty/src/main/java/io/grpc/transport/netty/Utils.java +++ b/netty/src/main/java/io/grpc/transport/netty/Utils.java @@ -55,6 +55,7 @@ import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; /** * Common utility methods. @@ -198,7 +199,7 @@ class Utils { @Override public void close(EventLoopGroup instance) { - instance.shutdownGracefully(); + instance.shutdownGracefully(0, 0, TimeUnit.SECONDS); } @Override