Class Cluster.Builder
java.lang.Object
org.apache.tinkerpop.gremlin.driver.Cluster.Builder
- Enclosing class:
- Cluster
-
Method Summary
Modifier and TypeMethodDescriptionaddContactPoint(String address) Adds the address of a Gremlin Server to the list of servers aClientwill try to contact to send requests to.addContactPoints(String... addresses) Add one or more the addresses of a Gremlin Servers to the list of servers aClientwill try to contact to send requests to.Adds an AuthRequestInterceptorthat will always be appended to the end of the interceptor list when theClusteris created, regardless of the order in which builder methods are called.batchSize(int size) Sets the default for the per-request batch size, used when a request does not specify its ownbatchSizeviaRequestOptions.bulkResults(boolean bulkResults) Configures whether cluster will enable result bulking to optimize performance.compression(Compression compression) Sets the wireCompressionalgorithm negotiated with the server.connectTimeout(Duration connectTimeout) Sets the TCP connection-establishment timeout.connectTimeoutMillis(int connectTimeout) Sets the duration of time in milliseconds that bounds TCP connection establishment (transport setup, including the SSL handshake).create()enableSsl(boolean enable) Enables connectivity over SSL - note that the server should be configured with SSL turned on for this setting to work properly.enableUserAgentOnConnect(boolean enableUserAgentOnConnect) Configures whether cluster will send a user agent during web socket handshakesidleTimeout(Duration idleTimeout) Sets the idle-connection pool timeout.idleTimeoutMillis(long idleTimeout) Sets the time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes.interceptors(List<RequestInterceptor> interceptors) Sets the list ofRequestInterceptorinstances that will be run in order to allow modification of theHttpRequestprior to its being sent to the server.interceptors(RequestInterceptor... interceptors) Sets the list ofRequestInterceptorinstances that will be run in order.keepAliveTime(Duration keepAliveTime) Sets the idle time before TCP keep-alive probes begin.keepAliveTimeMillis(long keepAliveTime) Sets the idle time in milliseconds before TCP keep-alive probes begin on an otherwise idle connection.The file location of the private key in JKS or PKCS#12 format.keyStorePassword(String keyStorePassword) The password of thekeyStore, ornullif it's not password-protected.keyStoreType(String keyStoreType) The format of thekeyStore, eitherJKSorPKCS12loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy) Specifies the load balancing strategy to use on the client side.maxConnections(int maxConnections) The maximum size that theConnectionPoolcan grow.maxResponseHeaderBytes(int maxResponseHeaderBytes) The maximum size in bytes allowed for the HTTP response headers.maxWaitForClose(int maxWait) The amount of time in milliseconds to wait the connection to close before timing out where the default value is 3000.maxWaitForConnection(int maxWait) The maximum amount of time to wait for a connection to be borrowed from the connection pool.nioPoolSize(int nioPoolSize) Size of the pool for handling request/response operations.The path to the Gremlin service on the host which is "/gremlin" by default.port(int port) Sets the port that the Gremlin Servers will be listening on.proxy(ProxyOptions proxyOptions) Routes connections through the supplied HTTP proxy.readTimeout(Duration readTimeout) Sets the idle-read timeout that bounds the time between inbound response chunks.readTimeoutMillis(long readTimeout) Sets the idle-read timeout in milliseconds that bounds the time between inbound response chunks.reconnectInterval(int interval) Time in milliseconds to wait between retries when attempting to reconnect to a dead host.responseSerializer(String mimeType) Set theMessageSerializerused to deserialize responses from the server given the exact name of aSerializersenum.responseSerializer(MessageSerializer<?> responseSerializer) Sets theMessageSerializerused to deserialize responses from the server.responseSerializer(Serializers mimeType) Set theMessageSerializerused to deserialize responses from the server via theSerializersenum.ssl(io.netty.handler.ssl.SslContext sslContext) Explicitly set theSslContextto use for SSL connections.sslCipherSuites(List<String> sslCipherSuites) A list of cipher suites to enable.sslEnabledProtocols(List<String> sslEnabledProtocols) A list of SSL protocols to enable.sslSkipCertValidation(boolean sslSkipCertValidation) If true, trust all certificates and do not perform any validation.trustStore(String trustStore) The file location for a SSL Certificate Chain to use when SSL is enabled.trustStorePassword(String trustStorePassword) The password of thetrustStore, ornullif it's not password-protected.trustStoreType(String trustStoreType) The format of thetrustStore, eitherJKSorPKCS12Configures the endpoint from a single URL string.validationRequest(String script) Specify a valid Gremlin script that can be used to test remote operations.workerPoolSize(int workerPoolSize) Size of the pool for handling background work.
-
Method Details
-
nioPoolSize
Size of the pool for handling request/response operations. Defaults to the number of available processors. -
workerPoolSize
Size of the pool for handling background work. Defaults to the number of available processors multiplied by 2 -
path
The path to the Gremlin service on the host which is "/gremlin" by default. -
responseSerializer
Set theMessageSerializerused to deserialize responses from the server given the exact name of aSerializersenum. This selects the encoding requested via theAcceptheader; requests are always sent as JSON regardless of this setting. Note that setting this value this way will not allow specific configuration of the serializer itself. If specific configuration is required please useresponseSerializer(MessageSerializer). -
responseSerializer
Set theMessageSerializerused to deserialize responses from the server via theSerializersenum. This selects the encoding requested via theAcceptheader; requests are always sent as JSON regardless of this setting. If specific configuration is required please useresponseSerializer(MessageSerializer). -
responseSerializer
Sets theMessageSerializerused to deserialize responses from the server. This selects the encoding requested via theAcceptheader; requests are always sent as JSON regardless of this setting. -
enableSsl
Enables connectivity over SSL - note that the server should be configured with SSL turned on for this setting to work properly. -
ssl
Explicitly set theSslContextto use for SSL connections. When set, all other SSL-related builder settings (key store, trust store, ciphers, protocols, skip-cert-validation) are ignored. -
keyStore
The file location of the private key in JKS or PKCS#12 format. -
keyStorePassword
The password of thekeyStore, ornullif it's not password-protected. -
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 defaultTrustManagerwill be used, which will have a set of common public certificates installed to it. -
trustStorePassword
The password of thetrustStore, ornullif it's not password-protected. -
keyStoreType
The format of thekeyStore, eitherJKSorPKCS12 -
trustStoreType
The format of thetrustStore, eitherJKSorPKCS12 -
sslEnabledProtocols
A list of SSL protocols to enable. @see JSSE Protocols -
sslCipherSuites
A list of cipher suites to enable. @see Cipher Suites -
sslSkipCertValidation
If true, trust all certificates and do not perform any validation. -
maxConnections
The maximum size that theConnectionPoolcan grow. -
batchSize
Sets the default for the per-request batch size, used when a request does not specify its ownbatchSizeviaRequestOptions. Defaults to 64. -
maxWaitForConnection
The maximum amount of time to wait for a connection to be borrowed from the connection pool. -
maxWaitForClose
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. -
maxResponseHeaderBytes
The maximum size in bytes allowed for the HTTP response headers. Defaults to 8192. Exposes the underlying NettyHttpClientCodecmax header size. -
readTimeoutMillis
Sets the idle-read timeout in milliseconds that bounds the time between inbound response chunks. The clock is reset on each chunk received, so it bounds idle gaps rather than the total response time. A value of0(the default) disables the feature. -
readTimeout
Sets the idle-read timeout that bounds the time between inbound response chunks. Equivalent toreadTimeoutMillis(long)with the duration expressed as aDuration.Duration.ZEROdisables the feature. -
compression
Sets the wireCompressionalgorithm negotiated with the server. Defaults toCompression.DEFLATE(compression on). SetCompression.NONEto disable. -
proxy
Routes connections through the supplied HTTP proxy. A NettyHttpProxyHandleris inserted into the pipeline before the SSL handler. -
validationRequest
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 sendsg.inject(0). -
reconnectInterval
Time in milliseconds to wait between retries when attempting to reconnect to a dead host. -
loadBalancingStrategy
Specifies the load balancing strategy to use on the client side. -
interceptors
Sets the list ofRequestInterceptorinstances that will be run in order to allow modification of theHttpRequestprior to its being sent to the server. -
interceptors
Sets the list ofRequestInterceptorinstances that will be run in order. -
auth
Adds an AuthRequestInterceptorthat will always be appended to the end of the interceptor list when theClusteris created, regardless of the order in which builder methods are called. -
addContactPoint
Adds the address of a Gremlin Server to the list of servers aClientwill 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
Add one or more the addresses of a Gremlin Servers to the list of servers aClientwill 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
Sets the port that the Gremlin Servers will be listening on. -
url
Configures the endpoint from a single URL string. The URL is parsed and applied to the builder as follows: the scheme selects SSL (httpsenables SSL,httpdisables it; other or absent schemes leave the current SSL setting unchanged), the host is added as a contact point, an explicit port is applied viaport(int), and a non-empty path is applied viapath(String). This is a convenience for the common single-host case; useaddContactPoint(String)/addContactPoints(String...)along withport(int)andpath(String)for multi-host configurations.Because this is a single-endpoint convenience, it must not be combined with the multi-host contact point methods: calling it after a contact point has already been added throws
IllegalArgumentException.- Parameters:
url- a full URL such ashttps://gremlin.example.com:8182/gremlin- Throws:
IllegalArgumentException- if the URL cannot be parsed, has no host, or a contact point already exists
-
connectTimeoutMillis
Sets the duration of time in milliseconds that bounds TCP connection establishment (transport setup, including the SSL handshake). Beyond this duration an exception would be thrown. This is a transport establishment timeout, not an HTTP request/response timeout. Defaults to 5000. -
connectTimeout
Sets the TCP connection-establishment timeout. Equivalent toconnectTimeoutMillis(int)with the duration expressed as aDuration. The value is applied via Netty's int-typedCONNECT_TIMEOUT_MILLIS, so it must not exceedInteger.MAX_VALUEmilliseconds. -
idleTimeoutMillis
Sets the time in milliseconds that the driver will allow a channel to not receive read or writes before it automatically closes. -
idleTimeout
Sets the idle-connection pool timeout. Equivalent toidleTimeoutMillis(long)with the duration expressed as aDuration.Duration.ZEROdisables idle-connection detection. -
keepAliveTimeMillis
Sets the idle time in milliseconds before TCP keep-alive probes begin on an otherwise idle connection. When set to a positive value theSO_KEEPALIVEsocket option is enabled and, where supported by the platform/JDK (JDK 11+ on Linux/macOS viaTCP_KEEPIDLE), the per-socket idle time is configured. On platforms/JDKs where the per-socket idle time cannot be set,SO_KEEPALIVEis still enabled and the OS default idle time is used. Defaults to 30000. Set this value to0to disable the feature. -
keepAliveTime
Sets the idle time before TCP keep-alive probes begin. Equivalent tokeepAliveTimeMillis(long)with the duration expressed as aDuration.Duration.ZEROdisables the feature. -
enableUserAgentOnConnect
Configures whether cluster will send a user agent during web socket handshakes- Parameters:
enableUserAgentOnConnect- true enables the useragent. false disables the useragent.
-
bulkResults
Configures whether cluster will enable result bulking to optimize performance.- Parameters:
bulkResults- true enables bulking.
-
create
-