Class Cluster
java.lang.Object
org.apache.tinkerpop.gremlin.driver.Cluster
A connection to a set of one or more Gremlin Server instances.
- Author:
- Stephen Mallette (http://stephen.genoprime.com)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionallHosts()Gets a list of all the configured hosts.Gets the list of hosts that theClusterwas able to connect to.static Cluster.Builderbuild()static Cluster.Builderstatic Cluster.Buildervoidclose()<T extends Client>
Tconnect()Creates a newClientbased on the settings provided.intGets the default for the per-request batch size used when the request does not specify one.Gets theCompressionalgorithm negotiated with the server.intGets the duration in milliseconds that bounds TCP connection establishment (including the SSL handshake).longGet time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.longGets the idle time in milliseconds before TCP keep-alive probes begin on an otherwise idle connection.Class<? extends LoadBalancingStrategy>Specifies the load balancing strategy to use on the client side.intGets the maximum size in bytes of the HTTP response headers.intGets how long a connection will wait for all pending messages to be returned from the server before closing.intGets the maximum amount of time to wait for a connection to be borrowed from the connection pool.getPath()Gets the path to the Gremlin service.intgetPort()Gets the port that the Gremlin Servers will be listening on.getProxy()Gets the configuredProxyOptionsornullif no proxy is configured.longGets the idle-read timeout in milliseconds that bounds the time between inbound response chunks.String[]Get theMessageSerializerMIME types supported.voidinit()booleanChecks if cluster is configured to bulk resultsbooleanisClosed()Determines if theClusterhas completed its closing process after a call toclose()orcloseAsync().booleanbooleanDetermines if connectivity over SSL is enabled.booleanChecks if cluster is configured to send a User Agent header in the web socket handshakeintGets the maximum size that theConnectionPoolcan grow.static Clusteropen()Create aClusterwith all default settings which will connect to one contact point atlocalhost.static ClusterCreate aClusterusing a YAML-based configuration file.static Clusteropen(org.apache.commons.configuration2.Configuration conf) Create aClusterfrom Apache Configurations.toString()voidtrackTransaction(org.apache.tinkerpop.gremlin.driver.remote.HttpRemoteTransaction tx) transact()Creates a newTransactionusing the server's default traversal source.Creates a newTransactionbound to the specified graph or traversal source.voiduntrackTransaction(org.apache.tinkerpop.gremlin.driver.remote.HttpRemoteTransaction tx)
-
Method Details
-
init
public void init() -
connect
Creates a newClientbased on the settings provided. -
transact
Creates a newTransactionusing the server's default traversal source. The server will bind to "g" by default when no traversal source is specified. -
transact
Creates a newTransactionbound to the specified graph or traversal source.- Parameters:
graphOrTraversalSource- the graph/traversal source alias, or null to use the server default
-
toString
-
build
-
build
-
build
- Throws:
FileNotFoundException
-
open
Create aClusterwith all default settings which will connect to one contact point atlocalhost. -
open
Create aClusterfrom Apache Configurations. -
open
Create aClusterusing 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
-
isClosing
public boolean isClosing() -
isClosed
public boolean isClosed()Determines if theClusterhas completed its closing process after a call toclose()orcloseAsync(). -
availableHosts
Gets the list of hosts that theClusterwas able to connect to. AHostis assumed unavailable until a connection to it is proven to be present. This will not happen until theClientsubmits requests that succeed in reaching a server at theHostorClient.init()is called which initializes theConnectionPoolfor theClientitself. The number of available hosts returned from this method will change as different servers come on and offline. -
getPath
Gets the path to the Gremlin service. -
getSerializers
Get theMessageSerializerMIME types supported. -
isSslEnabled
public boolean isSslEnabled()Determines if connectivity over SSL is enabled. -
maxConnections
public int maxConnections()Gets the maximum size that theConnectionPoolcan 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 of0disables the feature. -
getReadTimeout
public long getReadTimeout()Gets the idle-read timeout in milliseconds that bounds the time between inbound response chunks. A value of0disables the feature. -
getCompression
Gets theCompressionalgorithm negotiated with the server. -
getProxy
Gets the configuredProxyOptionsornullif no proxy is configured. -
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
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
-