Fixed a minor problem in closing a sessioned client that was not initialized CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3064b93a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3064b93a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3064b93a Branch: refs/heads/TINKERPOP-1545-tp32 Commit: 3064b93a5ceadf8f365fe26676a22f288c20b549 Parents: 061a2d4 Author: Stephen Mallette <sp...@genoprime.com> Authored: Wed Jan 4 10:00:27 2017 -0500 Committer: Stephen Mallette <sp...@genoprime.com> Committed: Wed Jan 4 10:00:27 2017 -0500 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../main/java/org/apache/tinkerpop/gremlin/driver/Client.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3064b93a/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d6fdc89..34e81c4 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Fixed minor bug in `gremlin-driver` where closing a session-based `Client` without initializing it could generate an error. * `TinkerGraph` Gryo and GraphSON deserialization is now configured to use multi-properties. * Changed behavior of `ElementHelper.areEqual(Property, Property)` to not throw exceptions with `null` arguments. * Added `GryoVersion` for future flexibility when introducing a new verison of Gryo and moved serializer registrations to it. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3064b93a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java ---------------------------------------------------------------------- diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 2c448dc..528f6b1 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -728,7 +728,10 @@ public abstract class Client { if (closing.get() != null) return closing.get(); - final CompletableFuture<Void> connectionPoolClose = connectionPool.closeAsync(); + // the connection pool may not have been initialized if requests weren't sent across it. in those cases + // we just need to return a pre-completed future + final CompletableFuture<Void> connectionPoolClose = null == connectionPool ? + CompletableFuture.completedFuture(null) : connectionPool.closeAsync(); closing.set(connectionPoolClose); return connectionPoolClose; }