You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/29 16:46:43 UTC
[2/3] tinkerpop git commit: Check if hosts are empty first before
bothering to do a shuffle to choose one at random. CTR
Check if hosts are empty first before bothering to do a shuffle to choose one at random. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1a2d3234
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1a2d3234
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1a2d3234
Branch: refs/heads/tp31
Commit: 1a2d3234620b2822f417275c5eb8b525bf88a5d6
Parents: 1b45e2a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Aug 29 12:43:38 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Aug 29 12:43:38 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a2d3234/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index afb2a7f..8fe87a9 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.1.4 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Improved the error provided by a client-side session if no hosts were available.
* Fixed a bug in `PropertiesTest` which assumed long id values.
* Fixed a bug in `StarGraph` around self-edges.
* Fixed a potential leak of a `ReferenceCounted` resource in Gremlin Server.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1a2d3234/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 4908d0e..4aca9ca 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
@@ -520,8 +520,8 @@ public abstract class Client {
// chooses an available host at random
final List<Host> hosts = cluster.allHosts()
.stream().filter(Host::isAvailable).collect(Collectors.toList());
- Collections.shuffle(hosts);
if (hosts.isEmpty()) throw new IllegalStateException("No available host in the cluster");
+ Collections.shuffle(hosts);
final Host host = hosts.get(0);
connectionPool = new ConnectionPool(host, this, Optional.of(1), Optional.of(1));
}