public abstract class Client extends Object
Client is constructed from a Cluster and represents a way to send messages to Gremlin Server.
 This class itself is a base class as there are different implementations that provide differing kinds of
 functionality.  See the implementations for specifics on their individual usage.
 
 The Client is designed to be re-used and shared across threads.| Modifier and Type | Class and Description | 
|---|---|
| static class  | Client.AliasClusteredClientUses a  Client.ClusteredClientthat rebinds requests to a
 specifiedGraphorTraversalSourceinstances on the server-side. | 
| static class  | Client.ClusteredClientA  Clientimplementation that does not operate in a session. | 
| static class  | Client.ReboundClusteredClientDeprecated. 
 As of release 3.1.1-incubating, replaced by  Client.AliasClusteredClient. | 
| static class  | Client.SessionedClientA  Clientimplementation that operates in the context of a session. | 
| static class  | Client.SessionSettingsSettings for a  Clientthat involve a session. | 
| static class  | Client.SettingsSettings given to  Cluster.connect(Client.Settings)that configures how aClientwill behave. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected Cluster | cluster | 
| protected boolean | initialized | 
| protected Client.Settings | settings | 
| Modifier and Type | Method and Description | 
|---|---|
| Client | alias(Map<String,String> aliases)Creates a  Clientthat supplies the specified set of aliases, thus allowing the user to re-name
 one or more globally definedGraphorTraversalSourceserver bindings for the context of
 the createdClient. | 
| Client | alias(String graphOrTraversalSource)Create a new  Clientthat aliases the specifiedGraphorTraversalSourcename on the
 server to a variable called "g" for the context of the requests made through thatClient. | 
| org.apache.tinkerpop.gremlin.driver.message.RequestMessage.Builder | buildMessage(org.apache.tinkerpop.gremlin.driver.message.RequestMessage.Builder builder)Makes any final changes to the builder and returns the constructed  RequestMessage. | 
| protected abstract org.apache.tinkerpop.gremlin.driver.Connection | chooseConnection(org.apache.tinkerpop.gremlin.driver.message.RequestMessage msg)Chooses a  Connectionto write the message to. | 
| void | close()Closes the client by making a synchronous call to  closeAsync(). | 
| abstract CompletableFuture<Void> | closeAsync()Asynchronous close of the  Client. | 
| Cluster | getCluster()Gets the  Clusterthat spawned thisClient. | 
| Client.Settings | getSettings()Gets the  Client.Settings. | 
| Client | init()Initializes the client which typically means that a connection is established to the server. | 
| protected abstract void | initializeImplementation()Called in the  init()method. | 
| abstract boolean | isClosing() | 
| protected Map<String,String> | makeDefaultAliasMap(String graphOrTraversalSource) | 
| Client | rebind(Map<String,String> rebindings)Deprecated.  | 
| Client | rebind(String graphOrTraversalSource)Deprecated. 
 As of release 3.1.0, replaced by  alias(String) | 
| ResultSet | submit(Bytecode bytecode)Submit a  Bytecodeto the server for remote execution. | 
| ResultSet | submit(String gremlin)Submits a Gremlin script to the server and returns a  ResultSetonce the write of the request is
 complete. | 
| ResultSet | submit(String gremlin,
      Map<String,Object> parameters)Submits a Gremlin script and bound parameters to the server and returns a  ResultSetonce the write of
 the request is complete. | 
| ResultSet | submit(Traversal traversal)Submit a  Traversalto the server for remote execution. | 
| CompletableFuture<ResultSet> | submitAsync(Bytecode bytecode)An asynchronous version of  submit(Traversal). | 
| CompletableFuture<ResultSet> | submitAsync(org.apache.tinkerpop.gremlin.driver.message.RequestMessage msg)A low-level method that allows the submission of a manually constructed  RequestMessage. | 
| CompletableFuture<ResultSet> | submitAsync(String gremlin)The asynchronous version of  submit(String)where the returned future will complete when the
 write of the request completes. | 
| CompletableFuture<ResultSet> | submitAsync(String gremlin,
           Map<String,Object> parameters)The asynchronous version of  submit(String, Map)} where the returned future will complete when the
 write of the request completes. | 
| CompletableFuture<ResultSet> | submitAsync(String gremlin,
           Map<String,String> aliases,
           Map<String,Object> parameters)The asynchronous version of  submit(String, Map)} where the returned future will complete when the
 write of the request completes. | 
| CompletableFuture<ResultSet> | submitAsync(String gremlin,
           String graphOrTraversalSource,
           Map<String,Object> parameters)The asynchronous version of  submit(String, Map)} where the returned future will complete when the
 write of the request completes. | 
| CompletableFuture<ResultSet> | submitAsync(Traversal traversal)An asynchronous version of  submit(Traversal). | 
protected final Cluster cluster
protected volatile boolean initialized
protected final Client.Settings settings
public org.apache.tinkerpop.gremlin.driver.message.RequestMessage.Builder buildMessage(org.apache.tinkerpop.gremlin.driver.message.RequestMessage.Builder builder)
RequestMessage.  Implementers
 may choose to override this message to append data to the request before sending.  By default, this method
 will simply return the builder passed in by the caller.protected abstract void initializeImplementation()
init() method.protected abstract org.apache.tinkerpop.gremlin.driver.Connection chooseConnection(org.apache.tinkerpop.gremlin.driver.message.RequestMessage msg)
                                                                            throws TimeoutException,
                                                                                   org.apache.tinkerpop.gremlin.driver.exception.ConnectionException
Connection to write the message to.TimeoutExceptionorg.apache.tinkerpop.gremlin.driver.exception.ConnectionExceptionpublic abstract CompletableFuture<Void> closeAsync()
Client.@Deprecated public Client rebind(String graphOrTraversalSource)
alias(String)Client that aliases the specified Graph or TraversalSource name on the
 server to a variable called "g" for the context of the requests made through that Client.graphOrTraversalSource - rebinds the specified global Gremlin Server variable to "g"public Client alias(String graphOrTraversalSource)
Client that aliases the specified Graph or TraversalSource name on the
 server to a variable called "g" for the context of the requests made through that Client.graphOrTraversalSource - rebinds the specified global Gremlin Server variable to "g"@Deprecated public Client rebind(Map<String,String> rebindings)
Client that supplies the specified set of aliases, thus allowing the user to re-name
 one or more globally defined Graph or TraversalSource server bindings for the context of
 the created Client.public Client alias(Map<String,String> aliases)
Client that supplies the specified set of aliases, thus allowing the user to re-name
 one or more globally defined Graph or TraversalSource server bindings for the context of
 the created Client.public ResultSet submit(Traversal traversal)
Traversal to the server for remote execution.public CompletableFuture<ResultSet> submitAsync(Traversal traversal)
submit(Traversal).public ResultSet submit(Bytecode bytecode)
Bytecode to the server for remote execution.public CompletableFuture<ResultSet> submitAsync(Bytecode bytecode)
submit(Traversal).public Client init()
public ResultSet submit(String gremlin)
ResultSet once the write of the request is
 complete.gremlin - the gremlin script to executepublic ResultSet submit(String gremlin, Map<String,Object> parameters)
ResultSet once 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 to
 submit(String).  Parameterized scripts will perform better.gremlin - the gremlin script to executeparameters - a map of parameters that will be bound to the script on executionpublic CompletableFuture<ResultSet> submitAsync(String gremlin)
submit(String) where the returned future will complete when the
 write of the request completes.gremlin - the gremlin script to executepublic CompletableFuture<ResultSet> submitAsync(String gremlin, Map<String,Object> parameters)
submit(String, Map)} where the returned future will complete when the
 write of the request completes.gremlin - the gremlin script to executeparameters - a map of parameters that will be bound to the script on executionpublic CompletableFuture<ResultSet> submitAsync(String gremlin, String graphOrTraversalSource, Map<String,Object> parameters)
submit(String, Map)} where the returned future will complete when the
 write of the request completes.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"public CompletableFuture<ResultSet> submitAsync(String gremlin, Map<String,String> aliases, Map<String,Object> parameters)
submit(String, Map)} where the returned future will complete when the
 write of the request completes.gremlin - the gremlin script to executeparameters - a map of parameters that will be bound to the script on executionaliases - aliases the specified global Gremlin Server variable some other name that then be used in the
                script where the key is the alias name and the value represents the global variable on the
                serverpublic CompletableFuture<ResultSet> submitAsync(org.apache.tinkerpop.gremlin.driver.message.RequestMessage msg)
RequestMessage.public abstract boolean isClosing()
public void close()
closeAsync().public Client.Settings getSettings()
Client.Settings.Copyright © 2013–2017 Apache Software Foundation. All rights reserved.