You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by di...@apache.org on 2020/11/30 02:20:55 UTC

[tinkerpop] branch 3.4-dev updated: TINKERPOP-2445 Remove quiet time when shutting down Java client (#1363)

This is an automated email from the ASF dual-hosted git repository.

divijv pushed a commit to branch 3.4-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.4-dev by this push:
     new 6e67b3e  TINKERPOP-2445 Remove quiet time when shutting down Java client (#1363)
6e67b3e is described below

commit 6e67b3e26b19039a7d490eeb93be6a1f3d9095be
Author: Divij Vaidya <di...@amazon.com>
AuthorDate: Sun Nov 29 18:20:44 2020 -0800

    TINKERPOP-2445 Remove quiet time when shutting down Java client (#1363)
---
 CHANGELOG.asciidoc                                                 | 1 +
 .../src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1fcfb79..ba20a37 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -71,6 +71,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Connections to the server in a connection pool are created in parallel instead of serially in Java Driver.
 * Connection pools for multiple endpoints are created in parallel instead of serially in Java Driver.
 * Introduced new HostNotAvailable exception to represent cases when no server with active connection is available. 
+* Don't wait for new requests during shutdown of event loop group in Java Driver.
 
 [[release-3-4-8]]
 === TinkerPop 3.4.8 (Release Date: August 3, 2020)
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index 6578f42..ab08f53 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -64,6 +64,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
@@ -1081,7 +1082,7 @@ public final class Cluster {
     }
 
     static class Factory {
-        private final EventLoopGroup group;
+        private final NioEventLoopGroup group;
 
         public Factory(final int nioPoolSize) {
             final BasicThreadFactory threadFactory = new BasicThreadFactory.Builder().namingPattern("gremlin-driver-loop-%d").build();
@@ -1095,7 +1096,9 @@ public final class Cluster {
         }
 
         void shutdown() {
-            group.shutdownGracefully().awaitUninterruptibly();
+            // Do not provide a quiet period (default is 2s) to accept more requests. Once we have decided to shutdown,
+            // no new requests should be accepted.
+            group.shutdownGracefully(/*quiet period*/0, /*timeout*/2, TimeUnit.SECONDS).awaitUninterruptibly();
         }
     }