Class Cluster.Builder
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.driver.Cluster.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cluster.Builder
addContactPoint(String address)
Adds the address of a Gremlin Server to the list of servers aClient
will try to contact to send requests to.Cluster.Builder
addContactPoints(String... addresses)
Add one or more the addresses of a Gremlin Servers to the list of servers aClient
will try to contact to send requests to.Cluster.Builder
addInterceptor(String name, RequestInterceptor interceptor)
Adds aRequestInterceptor
to the end of the list that will allow manipulation of theHttpRequest
prior to its being sent to the server.Cluster.Builder
addInterceptorAfter(String priorInterceptorName, String nameOfInterceptor, RequestInterceptor interceptor)
Adds aRequestInterceptor
after another one that will allow manipulation of theHttpRequest
prior to its being sent to the server.Cluster.Builder
addInterceptorBefore(String subsequentInterceptorName, String nameOfInterceptor, RequestInterceptor interceptor)
Adds aRequestInterceptor
before another one that will allow manipulation of theHttpRequest
prior to its being sent to the server.Cluster.Builder
auth(org.apache.tinkerpop.gremlin.driver.auth.Auth auth)
Adds an AuthRequestInterceptor
to the end of list of interceptors.Cluster.Builder
bulkResults(boolean bulkResults)
Configures whether cluster will enable result bulking to optimize performance.Cluster.Builder
connectionSetupTimeoutMillis(long connectionSetupTimeoutMillis)
Sets the duration of time in milliseconds provided for connection setup to complete which includes WebSocket handshake and SSL handshake.Cluster
create()
Cluster.Builder
enableSsl(boolean enable)
Enables connectivity over SSL - note that the server should be configured with SSL turned on for this setting to work properly.Cluster.Builder
enableUserAgentOnConnect(boolean enableUserAgentOnConnect)
Configures whether cluster will send a user agent during web socket handshakesCluster.Builder
idleConnectionTimeoutMillis(long idleConnectionTimeoutMillis)
Sets the time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.Cluster.Builder
keyStore(String keyStore)
The file location of the private key in JKS or PKCS#12 format.Cluster.Builder
keyStorePassword(String keyStorePassword)
The password of thekeyStore
, ornull
if it's not password-protected.Cluster.Builder
keyStoreType(String keyStoreType)
Cluster.Builder
loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)
Specifies the load balancing strategy to use on the client side.Cluster.Builder
maxConnectionPoolSize(int maxSize)
The maximum size that theConnectionPool
can grow.Cluster.Builder
maxResponseContentLength(long maxResponseContentLength)
The maximum size in bytes of any response received from the server.Cluster.Builder
maxWaitForClose(int maxWait)
The amount of time in milliseconds to wait the connection to close before timing out where the default value is 3000.Cluster.Builder
maxWaitForConnection(int maxWait)
The maximum amount of time to wait for a connection to be borrowed from the connection pool.Cluster.Builder
nioPoolSize(int nioPoolSize)
Size of the pool for handling request/response operations.Cluster.Builder
path(String path)
The path to the Gremlin service on the host which is "/gremlin" by default.Cluster.Builder
port(int port)
Sets the port that the Gremlin Servers will be listening on.Cluster.Builder
reconnectInterval(int interval)
Time in milliseconds to wait between retries when attempting to reconnect to a dead host.Cluster.Builder
removeInterceptor(String name)
Removes aRequestInterceptor
from the list.Cluster.Builder
resultIterationBatchSize(int size)
Override the server setting that determines how many results are returned per batch.Cluster.Builder
serializer(String mimeType)
Set theMessageSerializer
to use given the exact name of aSerializers
enum.Cluster.Builder
serializer(MessageSerializer<?> serializer)
Sets theMessageSerializer
to use.Cluster.Builder
serializer(org.apache.tinkerpop.gremlin.util.ser.Serializers mimeType)
Set theMessageSerializer
to use via theSerializers
enum.Cluster.Builder
sslCipherSuites(List<String> sslCipherSuites)
A list of cipher suites to enable.Cluster.Builder
sslContext(io.netty.handler.ssl.SslContext sslContext)
Explicitly set theSslContext
for when more flexibility is required in the configuration than is allowed by theCluster.Builder
.Cluster.Builder
sslEnabledProtocols(List<String> sslEnabledProtocols)
A list of SSL protocols to enable.Cluster.Builder
sslSkipCertValidation(boolean sslSkipCertValidation)
If true, trust all certificates and do not perform any validation.Cluster.Builder
trustStore(String trustStore)
The file location for a SSL Certificate Chain to use when SSL is enabled.Cluster.Builder
trustStorePassword(String trustStorePassword)
The password of thetrustStore
, ornull
if it's not password-protected.Cluster.Builder
trustStoreType(String trustStoreType)
Cluster.Builder
validationRequest(String script)
Specify a valid Gremlin script that can be used to test remote operations.Cluster.Builder
workerPoolSize(int workerPoolSize)
Size of the pool for handling background work.
-
-
-
Method Detail
-
nioPoolSize
public Cluster.Builder nioPoolSize(int nioPoolSize)
Size of the pool for handling request/response operations. Defaults to the number of available processors.
-
workerPoolSize
public Cluster.Builder workerPoolSize(int workerPoolSize)
Size of the pool for handling background work. Defaults to the number of available processors multiplied by 2
-
path
public Cluster.Builder path(String path)
The path to the Gremlin service on the host which is "/gremlin" by default.
-
serializer
public Cluster.Builder serializer(String mimeType)
Set theMessageSerializer
to use given the exact name of aSerializers
enum. Note that setting this value this way will not allow specific configuration of the serializer itself. If specific configuration is required * please useserializer(MessageSerializer)
.
-
serializer
public Cluster.Builder serializer(org.apache.tinkerpop.gremlin.util.ser.Serializers mimeType)
Set theMessageSerializer
to use via theSerializers
enum. If specific configuration is required please useserializer(MessageSerializer)
.
-
serializer
public Cluster.Builder serializer(MessageSerializer<?> serializer)
Sets theMessageSerializer
to use.
-
enableSsl
public Cluster.Builder enableSsl(boolean enable)
Enables connectivity over SSL - note that the server should be configured with SSL turned on for this setting to work properly.
-
sslContext
public Cluster.Builder sslContext(io.netty.handler.ssl.SslContext sslContext)
Explicitly set theSslContext
for when more flexibility is required in the configuration than is allowed by theCluster.Builder
. If this value is set to something other thannull
then all other related SSL settings are ignored. TheenableSsl
setting should still be set totrue
for this setting to take effect.
-
keyStore
public Cluster.Builder keyStore(String keyStore)
The file location of the private key in JKS or PKCS#12 format.
-
keyStorePassword
public Cluster.Builder keyStorePassword(String keyStorePassword)
The password of thekeyStore
, ornull
if it's not password-protected.
-
trustStore
public Cluster.Builder trustStore(String trustStore)
The file location for a SSL Certificate Chain to use when SSL is enabled. If this value is not provided and SSL is enabled, the defaultTrustManager
will be used, which will have a set of common public certificates installed to it.
-
trustStorePassword
public Cluster.Builder trustStorePassword(String trustStorePassword)
The password of thetrustStore
, ornull
if it's not password-protected.
-
keyStoreType
public Cluster.Builder keyStoreType(String keyStoreType)
-
trustStoreType
public Cluster.Builder trustStoreType(String trustStoreType)
-
sslEnabledProtocols
public Cluster.Builder sslEnabledProtocols(List<String> sslEnabledProtocols)
A list of SSL protocols to enable. @see JSSE Protocols
-
sslCipherSuites
public Cluster.Builder sslCipherSuites(List<String> sslCipherSuites)
A list of cipher suites to enable. @see Cipher Suites
-
sslSkipCertValidation
public Cluster.Builder sslSkipCertValidation(boolean sslSkipCertValidation)
If true, trust all certificates and do not perform any validation.
-
maxConnectionPoolSize
public Cluster.Builder maxConnectionPoolSize(int maxSize)
The maximum size that theConnectionPool
can grow.
-
resultIterationBatchSize
public Cluster.Builder resultIterationBatchSize(int size)
Override the server setting that determines how many results are returned per batch.
-
maxWaitForConnection
public Cluster.Builder maxWaitForConnection(int maxWait)
The maximum amount of time to wait for a connection to be borrowed from the connection pool.
-
maxWaitForClose
public Cluster.Builder maxWaitForClose(int maxWait)
The amount of time in milliseconds to wait the connection to close before timing out where the default value is 3000. This timeout allows for a delay to occur in waiting for remaining messages that may still be returning from the server while aClient.close()
is called.
-
maxResponseContentLength
public Cluster.Builder maxResponseContentLength(long maxResponseContentLength)
The maximum size in bytes of any response received from the server.
-
validationRequest
public Cluster.Builder validationRequest(String script)
Specify a valid Gremlin script that can be used to test remote operations. This script should be designed to return quickly with the least amount of overhead possible. By default, the script sends an empty string. If the graph does not support that sort of script because it requires all scripts to include a reference to a graph then a good option might beg.inject()
.
-
reconnectInterval
public Cluster.Builder reconnectInterval(int interval)
Time in milliseconds to wait between retries when attempting to reconnect to a dead host.
-
loadBalancingStrategy
public Cluster.Builder loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)
Specifies the load balancing strategy to use on the client side.
-
addInterceptorAfter
public Cluster.Builder addInterceptorAfter(String priorInterceptorName, String nameOfInterceptor, RequestInterceptor interceptor)
Adds aRequestInterceptor
after another one that will allow manipulation of theHttpRequest
prior to its being sent to the server.
-
addInterceptorBefore
public Cluster.Builder addInterceptorBefore(String subsequentInterceptorName, String nameOfInterceptor, RequestInterceptor interceptor)
Adds aRequestInterceptor
before another one that will allow manipulation of theHttpRequest
prior to its being sent to the server.
-
addInterceptor
public Cluster.Builder addInterceptor(String name, RequestInterceptor interceptor)
Adds aRequestInterceptor
to the end of the list that will allow manipulation of theHttpRequest
prior to its being sent to the server.
-
removeInterceptor
public Cluster.Builder removeInterceptor(String name)
Removes aRequestInterceptor
from the list. This can be used to remove the default interceptors that aren't needed.
-
auth
public Cluster.Builder auth(org.apache.tinkerpop.gremlin.driver.auth.Auth auth)
Adds an AuthRequestInterceptor
to the end of list of interceptors.
-
addContactPoint
public Cluster.Builder addContactPoint(String address)
Adds the address of a Gremlin Server to the list of servers aClient
will try to contact to send requests to. The address should be parseable byInetAddress.getByName(String)
. That's the only validation performed at this point. No connection to the host is attempted.
-
addContactPoints
public Cluster.Builder addContactPoints(String... addresses)
Add one or more the addresses of a Gremlin Servers to the list of servers aClient
will try to contact to send requests to. The address should be parseable byInetAddress.getByName(String)
. That's the only validation performed at this point. No connection to the host is attempted.
-
port
public Cluster.Builder port(int port)
Sets the port that the Gremlin Servers will be listening on.
-
connectionSetupTimeoutMillis
public Cluster.Builder connectionSetupTimeoutMillis(long connectionSetupTimeoutMillis)
Sets the duration of time in milliseconds provided for connection setup to complete which includes WebSocket handshake and SSL handshake. Beyond this duration an exception would be thrown.
-
idleConnectionTimeoutMillis
public Cluster.Builder idleConnectionTimeoutMillis(long idleConnectionTimeoutMillis)
Sets the time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.
-
enableUserAgentOnConnect
public Cluster.Builder enableUserAgentOnConnect(boolean enableUserAgentOnConnect)
Configures whether cluster will send a user agent during web socket handshakes- Parameters:
enableUserAgentOnConnect
- true enables the useragent. false disables the useragent.
-
bulkResults
public Cluster.Builder bulkResults(boolean bulkResults)
Configures whether cluster will enable result bulking to optimize performance.- Parameters:
bulkResults
- true enables bulking.
-
create
public Cluster create()
-
-