Class Cluster

java.lang.Object
org.apache.tinkerpop.gremlin.driver.Cluster

public final class Cluster extends Object
A connection to a set of one or more Gremlin Server instances.
Author:
Stephen Mallette (http://stephen.genoprime.com)
  • Method Details

    • init

      public void init()
    • connect

      public <T extends Client> T connect()
      Creates a new Client based on the settings provided.
    • transact

      public RemoteTransaction transact()
      Creates a new Transaction using the server's default traversal source. The server will bind to "g" by default when no traversal source is specified.
    • transact

      public RemoteTransaction transact(String graphOrTraversalSource)
      Creates a new Transaction bound to the specified graph or traversal source.
      Parameters:
      graphOrTraversalSource - the graph/traversal source alias, or null to use the server default
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • build

      public static Cluster.Builder build()
    • build

      public static Cluster.Builder build(String address)
    • build

      public static Cluster.Builder build(File configurationFile) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • open

      public static Cluster open()
      Create a Cluster with all default settings which will connect to one contact point at localhost.
    • open

      public static Cluster open(org.apache.commons.configuration2.Configuration conf)
      Create a Cluster from Apache Configurations.
    • open

      public static Cluster open(String configurationFile) throws Exception
      Create a Cluster using a YAML-based configuration file. First try to read the file from the file system and then from resources.
      Throws:
      Exception
    • close

      public void close()
    • closeAsync

      public CompletableFuture<Void> closeAsync()
    • isClosing

      public boolean isClosing()
      Determines if the Cluster is in the process of closing given a call to close() or closeAsync().
    • isClosed

      public boolean isClosed()
      Determines if the Cluster has completed its closing process after a call to close() or closeAsync().
    • availableHosts

      public List<URI> availableHosts()
      Gets the list of hosts that the Cluster was able to connect to. A Host is assumed unavailable until a connection to it is proven to be present. This will not happen until the Client submits requests that succeed in reaching a server at the Host or Client.init() is called which initializes the ConnectionPool for the Client itself. The number of available hosts returned from this method will change as different servers come on and offline.
    • getPath

      public String getPath()
      Gets the path to the Gremlin service.
    • getSerializers

      public String[] getSerializers()
      Get the MessageSerializer MIME types supported.
    • isSslEnabled

      public boolean isSslEnabled()
      Determines if connectivity over SSL is enabled.
    • maxConnections

      public int maxConnections()
      Gets the maximum size that the ConnectionPool can grow.
    • getBatchSize

      public int getBatchSize()
      Gets the default for the per-request batch size used when the request does not specify one.
    • getMaxWaitForConnection

      public int getMaxWaitForConnection()
      Gets the maximum amount of time to wait for a connection to be borrowed from the connection pool.
    • getMaxWaitForClose

      public int getMaxWaitForClose()
      Gets how long a connection will wait for all pending messages to be returned from the server before closing.
    • getMaxResponseHeaderBytes

      public int getMaxResponseHeaderBytes()
      Gets the maximum size in bytes of the HTTP response headers.
    • getIdleTimeout

      public long getIdleTimeout()
      Get time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.
    • getConnectTimeout

      public int getConnectTimeout()
      Gets the duration in milliseconds that bounds TCP connection establishment (including the SSL handshake).
    • getKeepAliveTime

      public long getKeepAliveTime()
      Gets the idle time in milliseconds before TCP keep-alive probes begin on an otherwise idle connection. A value of 0 disables the feature.
    • getReadTimeout

      public long getReadTimeout()
      Gets the idle-read timeout in milliseconds that bounds the time between inbound response chunks. A value of 0 disables the feature.
    • getCompression

      public Compression getCompression()
      Gets the Compression algorithm negotiated with the server.
    • getProxy

      public ProxyOptions getProxy()
      Gets the configured ProxyOptions or null if no proxy is configured.
    • getLoadBalancingStrategy

      public Class<? extends LoadBalancingStrategy> getLoadBalancingStrategy()
      Specifies the load balancing strategy to use on the client side.
    • getPort

      public int getPort()
      Gets the port that the Gremlin Servers will be listening on.
    • allHosts

      public Collection<Host> allHosts()
      Gets a list of all the configured hosts.
    • trackTransaction

      public void trackTransaction(org.apache.tinkerpop.gremlin.driver.remote.HttpRemoteTransaction tx)
    • untrackTransaction

      public void untrackTransaction(org.apache.tinkerpop.gremlin.driver.remote.HttpRemoteTransaction tx)
    • isUserAgentOnConnectEnabled

      public boolean isUserAgentOnConnectEnabled()
      Checks if cluster is configured to send a User Agent header in the web socket handshake
    • isBulkResultsEnabled

      public boolean isBulkResultsEnabled()
      Checks if cluster is configured to bulk results