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 2015/09/04 18:20:06 UTC
[2/4] incubator-tinkerpop git commit: Added more javadoc.
Added more javadoc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7351675f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7351675f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7351675f
Branch: refs/heads/tp30
Commit: 7351675f39b2749f9b342b43497d3a2567de40ed
Parents: 27322ab
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 4 12:18:24 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 4 12:18:24 2015 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/driver/Cluster.java | 46 ++++++++++++++++++++
1 file changed, 46 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7351675f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
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 a732ad5..9aeb9bf 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
@@ -71,6 +71,11 @@ public final class Cluster {
* Creates a {@link Client.ClusteredClient} instance to this {@code Cluster}, meaning requests will be routed to
* one or more servers (depending on the cluster configuration), where each request represents the entirety of a
* transaction. A commit or rollback (in case of error) is automatically executed at the end of the request.
+ * <p/>
+ * Note that calling this method does not imply that a connection is made to the server itself at this point.
+ * Therefore, if there is only one server specified in the {@code Cluster} and that server is not available an
+ * error will not be raised at this point. Connections get initialized in the {@link Client} when a request is
+ * submitted or can be directly initialized via {@link Client#init()}.
*/
public Client connect() {
return new Client.ClusteredClient(this);
@@ -81,6 +86,11 @@ public final class Cluster {
* a single server (randomly selected from the cluster), where the same bindings will be available on each request.
* Requests are bound to the same thread on the server and thus transactions may extend beyond the bounds of a
* single request. The transactions are managed by the user and must be committed or rolledback manually.
+ * <p/>
+ * Note that calling this method does not imply that a connection is made to the server itself at this point.
+ * Therefore, if there is only one server specified in the {@code Cluster} and that server is not available an
+ * error will not be raised at this point. Connections get initialized in the {@link Client} when a request is
+ * submitted or can be directly initialized via {@link Client#init()}.
*
* @param sessionId user supplied id for the session which should be unique (a UUID is ideal).
*/
@@ -178,6 +188,13 @@ public final class Cluster {
return manager.isClosing() && manager.close().isDone();
}
+ /**
+ * Gets the list of hosts that the {@code Cluster} was able to connect to. A {@link Host} is assumed unavailable
+ * until a connection to it is proven to be present. This will not happen until the the {@link Client} submits
+ * requests that succeed in reaching a server at the {@link Host} or {@link Client#init()} is called which
+ * initializes the {@link ConnectionPool} for the {@link Client} itself. The number of available hosts returned
+ * from this method will change as different servers come on and offline.
+ */
public List<URI> availableHosts() {
return Collections.unmodifiableList(allHosts().stream()
.filter(Host::isAvailable)
@@ -402,31 +419,52 @@ public final class Cluster {
return this;
}
+ /**
+ * Specifies the load balancing strategy to use on the client side.
+ */
public Builder loadBalancingStrategy(final LoadBalancingStrategy loadBalancingStrategy) {
this.loadBalancingStrategy = loadBalancingStrategy;
return this;
}
+ /**
+ * Specifies parameters for authentication to Gremlin Server.
+ */
public Builder authProperties(final AuthProperties authProps) {
this.authProps = authProps;
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#USERNAME} and {@link AuthProperties.Property#PASSWORD} properties
+ * for authentication to Gremlin Server.
+ */
public Builder credentials(final String username, final String password) {
authProps = authProps.with(AuthProperties.Property.USERNAME, username).with(AuthProperties.Property.PASSWORD, password);
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#PROTOCOL} properties for authentication to Gremlin Server.
+ */
public Builder protocol(final String protocol) {
this.authProps = authProps.with(AuthProperties.Property.PROTOCOL, protocol);
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#JAAS_ENTRY} properties for authentication to Gremlin Server.
+ */
public Builder jaasEntry(final String jaasEntry) {
this.authProps = authProps.with(AuthProperties.Property.JAAS_ENTRY, jaasEntry);
return this;
}
+ /**
+ * Adds the address of a Gremlin Server to the list of servers a {@link Client} will try to contact to send
+ * requests to. The address should be parseable by {@link InetAddress#getByName(String)}. That's the only
+ * validation performed at this point. No connection to the host is attempted.
+ */
public Builder addContactPoint(final String address) {
try {
this.addresses.add(InetAddress.getByName(address));
@@ -436,12 +474,20 @@ public final class Cluster {
}
}
+ /**
+ * Add one or more the addresses of a Gremlin Servers to the list of servers a {@link Client} will try to
+ * contact to send requests to. The address should be parseable by {@link InetAddress#getByName(String)}.
+ * That's the only validation performed at this point. No connection to the host is attempted.
+ */
public Builder addContactPoints(final String... addresses) {
for (String address : addresses)
addContactPoint(address);
return this;
}
+ /**
+ * Sets the port that the Gremlin Servers will be listening on.
+ */
public Builder port(final int port) {
this.port = port;
return this;