org.apache.tinkerpop.gremlin.driver

## Class Client.ClusteredClient

- java.lang.Object
- - org.apache.tinkerpop.gremlin.driver.Client
  - - org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient

- Enclosing class:
    Client

      public static final class Client.ClusteredClient
      extends Client

  A `Client` implementation that does not operate in a session. 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.ReboundClusteredClient, Client.SessionedClient, Client.SessionSettings, Client.Settings`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConcurrentMap<Host,org.apache.tinkerpop.gremlin.driver.ConnectionPool>` | `hostConnectionPools`

    - ### Fields inherited from class org.apache.tinkerpop.gremlin.driver.Client

      `cluster, initialized, settings`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Client` | `alias(Map<String,String> aliases)` Creates a `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`.
    `Client` | `alias(String graphOrTraversalSource)` Create a new `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`.
    `protected org.apache.tinkerpop.gremlin.driver.Connection` | `chooseConnection(RequestMessage msg)` Uses a `LoadBalancingStrategy` to choose the best `Host` and then selects the best connection from that host's connection pool.
    `CompletableFuture<Void>` | `closeAsync()` Closes all the connection pools on all hosts.
    `protected void` | `initializeImplementation()` Initializes the connection pools on all hosts.
    `boolean` | `isClosing()`
    `Client` | `rebind(Map<String,String> rebindings)` Deprecated.
    `Client` | `rebind(String graphOrTraversalSource)` Deprecated.
    `ResultSet` | `submit(String gremlin, String graphOrTraversalSource)` Submits a Gremlin script to the server and returns a `ResultSet` once the write of the request is complete.
    `ResultSet` | `submit(String gremlin, String graphOrTraversalSource, Map<String,Object> parameters)` Submits a Gremlin script and bound parameters to the server and returns a `ResultSet` once the write of the request is complete.
    `CompletableFuture<ResultSet>` | `submitAsync(String gremlin, Map<String,String> aliases, Map<String,Object> parameters)` The asynchronous version of `Client.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 `Client.submit(String, Map)`} where the returned future will complete when the write of the request completes.

    - ### Methods inherited from class org.apache.tinkerpop.gremlin.driver.Client

      `buildMessage, close, getCluster, getSettings, init, makeDefaultAliasMap, submit, submit, submit, submit, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### hostConnectionPools

          protected ConcurrentMap<Host,org.apache.tinkerpop.gremlin.driver.ConnectionPool> hostConnectionPools

  - ### Method Detail

    - #### isClosing

          public boolean isClosing()

      Specified by:
        `isClosing` in class `Client`

    - #### submit

          public ResultSet submit(String gremlin,
                                  String graphOrTraversalSource)

      Submits a Gremlin script to the server and returns a `ResultSet` once 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 a `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 `Client.submit(String)`. Parameterized scripts will perform better.
      Parameters:
        `gremlin` - the gremlin script to execute
        `parameters` - a map of parameters that will be bound to the script on execution
        `graphOrTraversalSource` - rebinds the specified global Gremlin Server variable to "g"

    - #### submitAsync

          public CompletableFuture<ResultSet> submitAsync(String gremlin,
                                                          String graphOrTraversalSource,
                                                          Map<String,Object> parameters)

      The asynchronous version of `Client.submit(String, Map)`} where the returned future will complete when the write of the request completes.
      Overrides:
        `submitAsync` in class `Client`
      Parameters:
        `gremlin` - the gremlin script to execute
        `parameters` - a map of parameters that will be bound to the script on execution
        `graphOrTraversalSource` - rebinds the specified global Gremlin Server variable to "g"

    - #### submitAsync

          public CompletableFuture<ResultSet> submitAsync(String gremlin,
                                                          Map<String,String> aliases,
                                                          Map<String,Object> parameters)

      The asynchronous version of `Client.submit(String, Map)`} where the returned future will complete when the write of the request completes.
      Overrides:
        `submitAsync` in class `Client`
      Parameters:
        `gremlin` - the gremlin script to execute
        `parameters` - a map of parameters that will be bound to the script on execution
        `aliases` - 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 server

    - #### rebind

          @Deprecated
          public Client rebind(String graphOrTraversalSource)

      Deprecated.
      Create a new `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`.
      Overrides:
        `rebind` in class `Client`
      Parameters:
        `graphOrTraversalSource` - rebinds the specified global Gremlin Server variable to "g"

    - #### alias

          public Client alias(String graphOrTraversalSource)

      Create a new `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`.
      Overrides:
        `alias` in class `Client`
      Parameters:
        `graphOrTraversalSource` - rebinds the specified global Gremlin Server variable to "g"

    - #### rebind

          @Deprecated
          public Client rebind(Map<String,String> rebindings)

      Deprecated.
      Creates a `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`.
      Overrides:
        `rebind` in class `Client`

    - #### alias

          public Client alias(Map<String,String> aliases)

      Creates a `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`.
      Overrides:
        `alias` in class `Client`

    - #### chooseConnection

          protected org.apache.tinkerpop.gremlin.driver.Connection chooseConnection(RequestMessage msg)
                                                                             throws TimeoutException,
                                                                                    ConnectionException

      Uses a `LoadBalancingStrategy` to choose the best `Host` and then selects the best connection from that host's connection pool.
      Specified by:
        `chooseConnection` in class `Client`
      Throws:
        `TimeoutException`
        `ConnectionException`

    - #### initializeImplementation

          protected void initializeImplementation()

      Initializes the connection pools on all hosts.
      Specified by:
        `initializeImplementation` in class `Client`

    - #### closeAsync

          public CompletableFuture<Void> closeAsync()

      Closes all the connection pools on all hosts.
      Specified by:
        `closeAsync` in class `Client`

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.