Class 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 Detail

      • 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
      • 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()
      • 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.
      • isSslEnabled

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

        public int maxConnectionPoolSize()
        Gets the maximum size that the ConnectionPool can grow.
      • getResultIterationBatchSize

        public int getResultIterationBatchSize()
        Gets the override for the server setting that determines how many results are returned per batch.
      • 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.
      • getMaxResponseContentLength

        public long getMaxResponseContentLength()
        Gets the maximum size in bytes of any request received from the server.
      • getIdleConnectionTimeout

        public long getIdleConnectionTimeout()
        Get time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.
      • 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