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.BuilderaddContactPoint(String address)Adds the address of a Gremlin Server to the list of servers aClientwill try to contact to send requests to.Cluster.BuilderaddContactPoints(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.Cluster.BuilderauthProperties(AuthProperties authProps)Specifies parameters for authentication to Gremlin Server.Cluster.Builderchannelizer(Class channelizerClass)Specify theChannelizerimplementation to use on the client when creating aConnection.Cluster.Builderchannelizer(String channelizerClass)Specify theChannelizerimplementation to use on the client when creating aConnection.Cluster.BuilderconnectionSetupTimeoutMillis(long connectionSetupTimeoutMillis)Sets the duration of time in milliseconds provided for connection setup to complete which includes WebSocket handshake and SSL handshake.Clustercreate()Cluster.Buildercredentials(String username, String password)Sets theAuthProperties.Property.USERNAMEandAuthProperties.Property.PASSWORDproperties for authentication to Gremlin Server.Cluster.BuilderenableSsl(boolean enable)Enables connectivity over SSL - note that the server should be configured with SSL turned on for this setting to work properly.Cluster.BuilderenableUserAgentOnConnect(boolean enableUserAgentOnConnect)Configures whether cluster will send a user agent during web socket handshakesCluster.BuilderhandshakeInterceptor(HandshakeInterceptor interceptor)Specifies anHandshakeInterceptorthat will allow manipulation of theFullHttpRequestprior to its being sent over the websocket.Cluster.BuilderjaasEntry(String jaasEntry)Sets theAuthProperties.Property.JAAS_ENTRYproperties for authentication to Gremlin Server.Cluster.BuilderkeepAliveInterval(long keepAliveInterval)Length of time in milliseconds to wait on an idle connection before sending a keep-alive request.Cluster.BuilderkeyStore(String keyStore)The file location of the private key in JKS or PKCS#12 format.Cluster.BuilderkeyStorePassword(String keyStorePassword)The password of thekeyStore, ornullif it's not password-protected.Cluster.BuilderkeyStoreType(String keyStoreType)Cluster.BuilderloadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy)Specifies the load balancing strategy to use on the client side.Cluster.BuildermaxConnectionPoolSize(int maxSize)The maximum size that theConnectionPoolcan grow.Cluster.BuildermaxContentLength(int maxContentLength)The maximum size in bytes of any request sent to the server.Cluster.BuildermaxInProcessPerConnection(int maxInProcessPerConnection)The maximum number of in-flight requests that can occur on aConnection.Cluster.BuildermaxSimultaneousUsagePerConnection(int maxSimultaneousUsagePerConnection)The maximum number of times that aConnectioncan be borrowed from the pool simultaneously.Cluster.BuildermaxWaitForClose(int maxWait)The amount of time in milliseconds to wait the connection to close before timing out where the default value is 3000.Cluster.BuildermaxWaitForConnection(int maxWait)The maximum amount of time to wait for a connection to be borrowed from the connection pool.Cluster.BuilderminConnectionPoolSize(int minSize)The minimum size of theConnectionPool.Cluster.BuilderminInProcessPerConnection(int minInProcessPerConnection)The minimum number of in-flight requests that can occur on aConnectionbefore it is considered for closing on return to theConnectionPool.Cluster.BuilderminSimultaneousUsagePerConnection(int minSimultaneousUsagePerConnection)The minimum number of times that aConnectionshould be borrowed from the pool before it falls under consideration for closing.Cluster.BuildernioPoolSize(int nioPoolSize)Size of the pool for handling request/response operations.Cluster.Builderpath(String path)The path to the Gremlin service on the host which is "/gremlin" by default.Cluster.Builderport(int port)Sets the port that the Gremlin Servers will be listening on.Cluster.Builderprotocol(String protocol)Sets theAuthProperties.Property.PROTOCOLproperties for authentication to Gremlin Server.Cluster.BuilderreconnectInterval(int interval)Time in milliseconds to wait between retries when attempting to reconnect to a dead host.Cluster.BuilderresultIterationBatchSize(int size)Override the server setting that determines how many results are returned per batch.Cluster.Builderserializer(String mimeType)Set theMessageSerializerto use given the exact name of aSerializersenum.Cluster.Builderserializer(MessageSerializer<?> serializer)Sets theMessageSerializerto use.Cluster.Builderserializer(Serializers mimeType)Set theMessageSerializerto use via theSerializersenum.Cluster.BuildersslCipherSuites(List<String> sslCipherSuites)A list of cipher suites to enable.Cluster.BuildersslContext(io.netty.handler.ssl.SslContext sslContext)Explicitly set theSslContextfor when more flexibility is required in the configuration than is allowed by theCluster.Builder.Cluster.BuildersslEnabledProtocols(List<String> sslEnabledProtocols)A list of SSL protocols to enable.Cluster.BuildersslSkipCertValidation(boolean sslSkipCertValidation)If true, trust all certificates and do not perform any validation.Cluster.BuildertrustStore(String trustStore)The file location for a SSL Certificate Chain to use when SSL is enabled.Cluster.BuildertrustStorePassword(String trustStorePassword)The password of thetrustStore, ornullif it's not password-protected.Cluster.BuildertrustStoreType(String trustStoreType)Cluster.BuildervalidationRequest(String script)Specify a valid Gremlin script that can be used to test remote operations.Cluster.BuilderworkerPoolSize(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 theMessageSerializerto use given the exact name of aSerializersenum. 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(Serializers mimeType)
Set theMessageSerializerto use via theSerializersenum. If specific configuration is required please useserializer(MessageSerializer).
-
serializer
public Cluster.Builder serializer(MessageSerializer<?> serializer)
Sets theMessageSerializerto 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 theSslContextfor when more flexibility is required in the configuration than is allowed by theCluster.Builder. If this value is set to something other thannullthen all other related SSL settings are ignored. TheenableSslsetting should still be set totruefor this setting to take effect.
-
keepAliveInterval
public Cluster.Builder keepAliveInterval(long keepAliveInterval)
Length of time in milliseconds to wait on an idle connection before sending a keep-alive request. Set to zero to disable this feature.
-
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, ornullif 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 defaultTrustManagerwill 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, ornullif 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.
-
minInProcessPerConnection
public Cluster.Builder minInProcessPerConnection(int minInProcessPerConnection)
The minimum number of in-flight requests that can occur on aConnectionbefore it is considered for closing on return to theConnectionPool.
-
maxInProcessPerConnection
public Cluster.Builder maxInProcessPerConnection(int maxInProcessPerConnection)
The maximum number of in-flight requests that can occur on aConnection. This represents an indication of how busy aConnectionis allowed to be. This number is linked to themaxSimultaneousUsagePerConnectionsetting, but is slightly different in that it refers to the total number of requests on aConnection. In other words, aConnectionmight be borrowed once to have multiple requests executed against it. This number controls the maximum number of requests whereasmaxSimultaneousUsagePerConnectioncontrols the times borrowed.
-
maxSimultaneousUsagePerConnection
public Cluster.Builder maxSimultaneousUsagePerConnection(int maxSimultaneousUsagePerConnection)
The maximum number of times that aConnectioncan be borrowed from the pool simultaneously. This represents an indication of how busy aConnectionis allowed to be. Set too large and theConnectionmay queue requests too quickly, rather than wait for an availableConnectionor create a fresh one. If set too small, theConnectionwill show as busy very quickly thus forcing waits for availableConnectioninstances in the pool when there is more capacity available.
-
minSimultaneousUsagePerConnection
public Cluster.Builder minSimultaneousUsagePerConnection(int minSimultaneousUsagePerConnection)
The minimum number of times that aConnectionshould be borrowed from the pool before it falls under consideration for closing. If aConnectionis not busy and theminConnectionPoolSizeis exceeded, then there is no reason to keep that connection open. Set too large andConnectionthat isn't busy will continue to consume resources when it is not being used. Set too small andConnectioninstances will be destroyed when the driver might still be busy.
-
maxConnectionPoolSize
public Cluster.Builder maxConnectionPoolSize(int maxSize)
The maximum size that theConnectionPoolcan grow.
-
minConnectionPoolSize
public Cluster.Builder minConnectionPoolSize(int minSize)
The minimum size of theConnectionPool. When theClientis started,Connectionobjects will be initially constructed to this size.
-
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.
-
maxContentLength
public Cluster.Builder maxContentLength(int maxContentLength)
The maximum size in bytes of any request sent to the server. This number should not exceed the same setting defined on the server.
-
channelizer
public Cluster.Builder channelizer(String channelizerClass)
Specify theChannelizerimplementation to use on the client when creating aConnection.
-
channelizer
public Cluster.Builder channelizer(Class channelizerClass)
Specify theChannelizerimplementation to use on the client when creating aConnection.
-
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.
-
handshakeInterceptor
public Cluster.Builder handshakeInterceptor(HandshakeInterceptor interceptor)
Specifies anHandshakeInterceptorthat will allow manipulation of theFullHttpRequestprior to its being sent over the websocket.
-
authProperties
public Cluster.Builder authProperties(AuthProperties authProps)
Specifies parameters for authentication to Gremlin Server.
-
credentials
public Cluster.Builder credentials(String username, String password)
Sets theAuthProperties.Property.USERNAMEandAuthProperties.Property.PASSWORDproperties for authentication to Gremlin Server.
-
protocol
public Cluster.Builder protocol(String protocol)
Sets theAuthProperties.Property.PROTOCOLproperties for authentication to Gremlin Server.
-
jaasEntry
public Cluster.Builder jaasEntry(String jaasEntry)
Sets theAuthProperties.Property.JAAS_ENTRYproperties for authentication to Gremlin Server.
-
addContactPoint
public Cluster.Builder addContactPoint(String address)
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
public Cluster.Builder 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. 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.
-
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.
-
create
public Cluster create()
-
-