org.apache.tinkerpop.gremlin.driver

## Class Cluster.Builder

- java.lang.Object
- - org.apache.tinkerpop.gremlin.driver.Cluster.Builder

- Enclosing class:
    Cluster

      public static final class Cluster.Builder
      extends Object

- - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Cluster.Builder` | `addContactPoint(String address)` Adds the address of a Gremlin Server to the list of servers a `Client` 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 a `Client` will try to contact to send requests to.
    `Cluster.Builder` | `authProperties(AuthProperties authProps)` Specifies parameters for authentication to Gremlin Server.
    `Cluster.Builder` | `channelizer(Class channelizerClass)` Specify the `Channelizer` implementation to use on the client when creating a `Connection`.
    `Cluster.Builder` | `channelizer(String channelizerClass)` Specify the `Channelizer` implementation to use on the client when creating a `Connection`.
    `Cluster` | `create()`
    `Cluster.Builder` | `credentials(String username, String password)` Sets the `AuthProperties.Property.USERNAME` and `AuthProperties.Property.PASSWORD` properties for authentication to Gremlin Server.
    `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` | `jaasEntry(String jaasEntry)` Sets the `AuthProperties.Property.JAAS_ENTRY` properties for authentication to Gremlin Server.
    `Cluster.Builder` | `keepAliveInterval(long keepAliveInterval)` Length of time in milliseconds to wait on an idle connection before sending a keep-alive request.
    `Cluster.Builder` | `keyCertChainFile(String keyCertChainFile)` Deprecated. As of release 3.2.10, replaced by `keyStore`
    `Cluster.Builder` | `keyFile(String keyFile)` Deprecated. As of release 3.2.10, replaced by `keyStore`
    `Cluster.Builder` | `keyPassword(String keyPassword)` Deprecated. As of release 3.2.10, replaced by `keyStorePassword`
    `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 the `keyStore`, or `null` if it's not password-protected.
    `Cluster.Builder` | `keyStoreType(String keyStoreType)` The format of the `keyStore`, either `JKS` or `PKCS12`
    `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 the `ConnectionPool` can grow.
    `Cluster.Builder` | `maxContentLength(int maxContentLength)` The maximum size in bytes of any request sent to the server.
    `Cluster.Builder` | `maxInProcessPerConnection(int maxInProcessPerConnection)` The maximum number of in-flight requests that can occur on a `Connection`.
    `Cluster.Builder` | `maxSimultaneousUsagePerConnection(int maxSimultaneousUsagePerConnection)` The maximum number of times that a `Connection` can be borrowed from the pool simultaneously.
    `Cluster.Builder` | `maxWaitForConnection(int maxWait)` The maximum amount of time to wait for a connection to be borrowed from the connection pool.
    `Cluster.Builder` | `maxWaitForSessionClose(int maxWait)` If the connection is using a "session" this setting represents the amount of time in milliseconds to wait for that session to close before timing out where the default value is 3000.
    `Cluster.Builder` | `minConnectionPoolSize(int minSize)` The minimum size of the `ConnectionPool`.
    `Cluster.Builder` | `minInProcessPerConnection(int minInProcessPerConnection)` The minimum number of in-flight requests that can occur on a `Connection` before it is considered for closing on return to the `ConnectionPool`.
    `Cluster.Builder` | `minSimultaneousUsagePerConnection(int minSimultaneousUsagePerConnection)` The minimum number of times that a `Connection` should be borrowed from the pool before it falls under consideration for closing.
    `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` | `protocol(String protocol)` Sets the `AuthProperties.Property.PROTOCOL` properties for authentication to Gremlin Server.
    `Cluster.Builder` | `reconnectInterval(int interval)` Time in milliseconds to wait between retries when attempting to reconnect to a dead host.
    `Cluster.Builder` | `resultIterationBatchSize(int size)` Override the server setting that determines how many results are returned per batch.
    `Cluster.Builder` | `serializer(MessageSerializer serializer)` Sets the `MessageSerializer` to use.
    `Cluster.Builder` | `serializer(Serializers mimeType)` Set the `MessageSerializer` to use via the `Serializers` enum.
    `Cluster.Builder` | `serializer(String mimeType)` Set the `MessageSerializer` to use given the exact name of a `Serializers` enum.
    `Cluster.Builder` | `sslCipherSuites(List<String> sslCipherSuites)` A list of cipher suites to enable.
    `Cluster.Builder` | `sslContext(SslContext sslContext)` Explicitly set the `SslContext` for when more flexibility is required in the configuration than is allowed by the `Cluster.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` | `trustCertificateChainFile(String certificateChainFile)` Deprecated. As of release 3.2.10, replaced by `trustStore`
    `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 the `trustStore`, or `null` if it's not password-protected.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 the `MessageSerializer` to use given the exact name of a `Serializers` enum. Note that setting this value this way will not allow specific configuration of the serializer itself. If specific configuration is required * please use `serializer(MessageSerializer)`.

    - #### serializer

          public Cluster.Builder serializer(Serializers mimeType)

      Set the `MessageSerializer` to use via the `Serializers` enum. If specific configuration is required please use `serializer(MessageSerializer)`.

    - #### serializer

          public Cluster.Builder serializer(MessageSerializer serializer)

      Sets the `MessageSerializer` 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(SslContext sslContext)

      Explicitly set the `SslContext` for when more flexibility is required in the configuration than is allowed by the `Cluster.Builder`. If this value is set to something other than `null` then all other related SSL settings are ignored. The `enableSsl` setting should still be set to `true` for this setting to take effect.

    - #### trustCertificateChainFile

          @Deprecated
          public Cluster.Builder trustCertificateChainFile(String certificateChainFile)

      Deprecated. As of release 3.2.10, replaced by `trustStore`
      File location for a SSL Certificate Chain to use when SSL is enabled. If this value is not provided and SSL is enabled, the default `TrustManager` will be used.

    - #### keepAliveInterval

          public Cluster.Builder keepAliveInterval(long keepAliveInterval)

      Length of time in milliseconds to wait on an idle connection before sending a keep-alive request. This setting is only relevant to `Channelizer` implementations that return `true` for `Channelizer.supportsKeepAlive()`. Set to zero to disable this feature.

    - #### keyCertChainFile

          @Deprecated
          public Cluster.Builder keyCertChainFile(String keyCertChainFile)

      Deprecated. As of release 3.2.10, replaced by `keyStore`
      The X.509 certificate chain file in PEM format.

    - #### keyFile

          @Deprecated
          public Cluster.Builder keyFile(String keyFile)

      Deprecated. As of release 3.2.10, replaced by `keyStore`
      The PKCS#8 private key file in PEM format.

    - #### keyPassword

          @Deprecated
          public Cluster.Builder keyPassword(String keyPassword)

      Deprecated. As of release 3.2.10, replaced by `keyStorePassword`
      The password of the `keyFile`, or `null` if it's not password-protected.

    - #### 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 the `keyStore`, or `null` 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 default `TrustManager` will be used.

    - #### trustStorePassword

          public Cluster.Builder trustStorePassword(String trustStorePassword)

      The password of the `trustStore`, or `null` if it's not password-protected.

    - #### keyStoreType

          public Cluster.Builder keyStoreType(String keyStoreType)

      The format of the `keyStore`, either `JKS` or `PKCS12`

    - #### 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 a `Connection` before it is considered for closing on return to the `ConnectionPool`.

    - #### maxInProcessPerConnection

          public Cluster.Builder maxInProcessPerConnection(int maxInProcessPerConnection)

      The maximum number of in-flight requests that can occur on a `Connection`. This represents an indication of how busy a `Connection` is allowed to be. This number is linked to the `maxSimultaneousUsagePerConnection` setting, but is slightly different in that it refers to the total number of requests on a `Connection`. In other words, a `Connection` might be borrowed once to have multiple requests executed against it. This number controls the maximum number of requests whereas `maxInProcessPerConnection` controls the times borrowed.

    - #### maxSimultaneousUsagePerConnection

          public Cluster.Builder maxSimultaneousUsagePerConnection(int maxSimultaneousUsagePerConnection)

      The maximum number of times that a `Connection` can be borrowed from the pool simultaneously. This represents an indication of how busy a `Connection` is allowed to be. Set too large and the `Connection` may queue requests too quickly, rather than wait for an available `Connection` or create a fresh one. If set too small, the `Connection` will show as busy very quickly thus forcing waits for available `Connection` instances in the pool when there is more capacity available.

    - #### minSimultaneousUsagePerConnection

          public Cluster.Builder minSimultaneousUsagePerConnection(int minSimultaneousUsagePerConnection)

      The minimum number of times that a `Connection` should be borrowed from the pool before it falls under consideration for closing. If a `Connection` is not busy and the `minConnectionPoolSize` is exceeded, then there is no reason to keep that connection open. Set too large and `Connection` that isn't busy will continue to consume resources when it is not being used. Set too small and `Connection` instances will be destroyed when the driver might still be busy.

    - #### maxConnectionPoolSize

          public Cluster.Builder maxConnectionPoolSize(int maxSize)

      The maximum size that the `ConnectionPool` can grow.

    - #### minConnectionPoolSize

          public Cluster.Builder minConnectionPoolSize(int minSize)

      The minimum size of the `ConnectionPool`. When the `Client` is started, `Connection` objects 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.

    - #### maxWaitForSessionClose

          public Cluster.Builder maxWaitForSessionClose(int maxWait)

      If the connection is using a "session" this setting represents the amount of time in milliseconds to wait for that session to close before timing out where the default value is 3000. Note that the server will eventually clean up dead sessions itself on expiration of the session or during shutdown.

    - #### 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 the `Channelizer` implementation to use on the client when creating a `Connection`.

    - #### channelizer

          public Cluster.Builder channelizer(Class channelizerClass)

      Specify the `Channelizer` implementation to use on the client when creating a `Connection`.

    - #### 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 be `g.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.

    - #### authProperties

          public Cluster.Builder authProperties(AuthProperties authProps)

      Specifies parameters for authentication to Gremlin Server.

    - #### credentials

          public Cluster.Builder credentials(String username,
                                             String password)

      Sets the `AuthProperties.Property.USERNAME` and `AuthProperties.Property.PASSWORD` properties for authentication to Gremlin Server.

    - #### protocol

          public Cluster.Builder protocol(String protocol)

      Sets the `AuthProperties.Property.PROTOCOL` properties for authentication to Gremlin Server.

    - #### jaasEntry

          public Cluster.Builder jaasEntry(String jaasEntry)

      Sets the `AuthProperties.Property.JAAS_ENTRY` properties for authentication to Gremlin Server.

    - #### addContactPoint

          public Cluster.Builder addContactPoint(String address)

      Adds the address of a Gremlin Server to the list of servers a `Client` will try to contact to send requests to. The address should be parseable by `InetAddress.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 a `Client` will try to contact to send requests to. The address should be parseable by `InetAddress.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.

    - #### create

          public Cluster create()

Copyright © 2013–2020 Apache Software Foundation. All rights reserved.