Class Client.ClusteredClient
java.lang.Object
org.apache.tinkerpop.gremlin.driver.Client
org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient
- All Implemented Interfaces:
RequestSubmitter,RequestSubmitterAsync
- Enclosing class:
- Client
A
Client implementation. Requests are sent to multiple servers given a LoadBalancingStrategy.
Transactions are automatically committed (or rolled-back on error) after each request.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tinkerpop.gremlin.driver.Client
Client.AliasClusteredClient, Client.ClusteredClient, Client.PinnedClient -
Field Summary
Fields inherited from class org.apache.tinkerpop.gremlin.driver.Client
cluster, initialized, TOO_MANY_IN_FLIGHT_REQUESTS -
Method Summary
Modifier and TypeMethodDescriptionCreate a newClientthat aliases the specifiedGraphorTraversalSourcename on the server to a variable called "g" for the context of the requests made through thatClient.protected org.apache.tinkerpop.gremlin.driver.ConnectionUses aLoadBalancingStrategyto choose the bestHostand then selects the best connection from that host's connection pool.Closes all the connection pools on all hosts.protected voidInitializes the connection pools on all hosts.booleanSubmits a Gremlin script to the server and returns aResultSetonce the write of the request is complete.Submits a Gremlin script and bound parameters to the server and returns aResultSetonce the write of the request is complete.booleantryReInitializeHost(Host host) Attempt to re-initialize theHostthat was previously marked as unavailable.Methods inherited from class org.apache.tinkerpop.gremlin.driver.Client
buildMessage, chooseRandomHost, close, getCluster, init, submit, submit, submit, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync
-
Method Details
-
isClosing
public boolean isClosing() -
submit
Submits a Gremlin script to the server and returns aResultSetonce the write of the request is complete.- Parameters:
gremlin- the gremlin script to execute
-
submit
public ResultSet submit(String gremlin, String graphOrTraversalSource, Map<String, Object> parameters) Submits a Gremlin script and bound parameters to the server and returns aResultSetonce the write of the request is complete. If a script is to be executed repeatedly with slightly different arguments, prefer this method to concatenating a Gremlin script from dynamically produced strings and sending it toClient.submit(String). Parameterized scripts will perform better.- Parameters:
gremlin- the gremlin script to executeparameters- a map of parameters that will be bound to the script on executiongraphOrTraversalSource- rebinds the specified global Gremlin Server variable to "g"
-
alias
Create a newClientthat aliases the specifiedGraphorTraversalSourcename on the server to a variable called "g" for the context of the requests made through thatClient. -
chooseConnection
protected org.apache.tinkerpop.gremlin.driver.Connection chooseConnection(RequestMessage msg) throws TimeoutException, ConnectionException Uses aLoadBalancingStrategyto choose the bestHostand then selects the best connection from that host's connection pool.- Specified by:
chooseConnectionin classClient- Throws:
TimeoutExceptionConnectionException
-
initializeImplementation
protected void initializeImplementation()Initializes the connection pools on all hosts.- Specified by:
initializeImplementationin classClient
-
closeAsync
Closes all the connection pools on all hosts.- Specified by:
closeAsyncin classClient
-
tryReInitializeHost
-