Class Client2Config
Client2
 VoltDB client. A Client2Config object is passed
 as input to ClientFactory.createClient(), which
 generates a Client2 with the desired characteristics.- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDefault hard limit on requests pending in client; further requests refused (1000)static final intDefault level at which application gets backpressure-off notification (200)static final intDefault soft limit on requests pending in client; application gets backpressure-on notification (800)static final longDefault timeout on seeing any response on a connection (2 minutes)static final longDefault connection setup timeout (30 seconds)static final intDefault level at which Volt network layer reports backpressure to Volt client internally (100)static final intDefault limit for transactions posted to server on connection (100)static final longDefault timeout for each procedue call (2 minutes)static final longDefault delay before first attempt to recover a failed connection (1 second)static final longDefault delay between reconnection retries (15 seconds)static final intDefault priority for requests that do not explicitly set a priority (4)static final intDefault size of thread pool for dispatching responses (4)static final intHighest priority allowed for procedure calls (1)static final intLowest priority allowed for procedure calls (8)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionauthenticatedSubject(Subject subject) Sets the authenticated subject to be used for connections to VoltDB.clientRequestBackpressureLevel(int warning, int resume) Sets levels for controlling backpressure notifications.clientRequestLimit(int limit) Sets the limit on the number of requests that can be pending in a client at any one time.Registers a handler for connection-establishment failures.Registers a handler for connection-down events.connectionResponseTimeout(long timeout, TimeUnit unit) Sets the connection response timeout.connectionSetupTimeout(long timeout, TimeUnit unit) Sets the timeout for connection setup, including authentication to the server.Registers a handler for connection-up events.Configures trust store for TLS/SSL using installation defaults.Disable automatic connection management.Enables TLS/SSL for server connections.If TLS/SSL is enabled, this enables verification of the host identification (either dnsName or IP address) in the X.509 certificate's SubjectAlternativeName extension.Registers an error-log handler.hashedPassword(String password) Set hashed password for connections to VoltDB.hashedPassword(String password, org.voltdb.client.ClientAuthScheme hashScheme) Deprecated.Registers a handler for late server responses.loginContext(String name) Creates a new login context and authenticates the user, then adds the authenticated subject to this client configuration.networkBackpressureLevel(int level) This setting controls the maximum number of requests that the Client2 API can have queued at the VoltDB network layer for a single connection.outstandingTransactionLimit(int limit) Sets the limit on the number of transactions that can be outstanding at the VoltDB server at any one time.Set cleartext password for connections to VoltDB.procedureCallTimeout(long timeout, TimeUnit unit) Sets the timeout for procedure calls.reconnectDelay(long initialDelay, long retryDelay, TimeUnit unit) Sets delay times for attempts to reconnect failed connections.Registers a handler to be notified about changes in request backpressure.requestPriority(int prio) Sets the default priority for procedure calls from aClient2created using this configuration.responseExecutorService(ExecutorService execService, boolean stopOnClose) Provides anExecutorServicewith which to completecallProcedurerequests.responseThreadCount(int count) Sets the fixed number of 'response' threads to be available in the pool of such threads.roundingMode(boolean enable, RoundingMode mode) Enables or disables the rounding mode in the client.transactionRateLimit(int tpsLimit) Limits the rate at which transactions can be queued for transmission to the VoltDB server.trustStore(String path, String password) Configures trust store for TLS/SSL using a specified trust store file and an optional password.trustStoreFromFile(String path) A generalized routine to configure a TLS/SSL trust store, and in one case an optional key store, from a specified file.Configure a TLS/SSL trust store via a property file.trustStoreWithMutualAuth(String trustPath, String trustPass, String keyPath, String keyPass) Configures trust store for TLS/SSL using a specified trust store file and an optional password, and a key store which may be used for mutual TLS, when required by the server.trustStoreWithMutualAuth(String trustPath, String trustPass, String keyPath, String keyPass, String keyCertFile) Configures trust store for TLS/SSL using a specified trust store file and an optional password, and a key store which may be used for mutual TLS, when required by the server.Set username for connections to VoltDB.
- 
Field Details- 
DEFAULT_CONNECTION_SETUP_TIMEOUTpublic static final long DEFAULT_CONNECTION_SETUP_TIMEOUTDefault connection setup timeout (30 seconds)
- 
DEFAULT_CONNECTION_RESPONSE_TIMEOUTpublic static final long DEFAULT_CONNECTION_RESPONSE_TIMEOUTDefault timeout on seeing any response on a connection (2 minutes)
- 
DEFAULT_PROCEDURE_TIMEOUTpublic static final long DEFAULT_PROCEDURE_TIMEOUTDefault timeout for each procedue call (2 minutes)
- 
DEFAULT_CLIENT_REQUEST_HARD_LIMITpublic static final int DEFAULT_CLIENT_REQUEST_HARD_LIMITDefault hard limit on requests pending in client; further requests refused (1000)- See Also:
 
- 
DEFAULT_CLIENT_REQUEST_WARNING_LEVELpublic static final int DEFAULT_CLIENT_REQUEST_WARNING_LEVELDefault soft limit on requests pending in client; application gets backpressure-on notification (800)- See Also:
 
- 
DEFAULT_CLIENT_REQUEST_RESUME_LEVELpublic static final int DEFAULT_CLIENT_REQUEST_RESUME_LEVELDefault level at which application gets backpressure-off notification (200)- See Also:
 
- 
DEFAULT_OUTSTANDING_TRANSACTION_LIMITpublic static final int DEFAULT_OUTSTANDING_TRANSACTION_LIMITDefault limit for transactions posted to server on connection (100)- See Also:
 
- 
DEFAULT_NETWORK_BACKPRESSURE_LEVELpublic static final int DEFAULT_NETWORK_BACKPRESSURE_LEVELDefault level at which Volt network layer reports backpressure to Volt client internally (100)- See Also:
 
- 
DEFAULT_RECONNECT_DELAYpublic static final long DEFAULT_RECONNECT_DELAYDefault delay before first attempt to recover a failed connection (1 second)
- 
DEFAULT_RECONNECT_RETRY_DELAYpublic static final long DEFAULT_RECONNECT_RETRY_DELAYDefault delay between reconnection retries (15 seconds)
- 
DEFAULT_REQUEST_PRIORITYpublic static final int DEFAULT_REQUEST_PRIORITYDefault priority for requests that do not explicitly set a priority (4)- See Also:
 
- 
DEFAULT_RESPONSE_THREADSpublic static final int DEFAULT_RESPONSE_THREADSDefault size of thread pool for dispatching responses (4)- See Also:
 
- 
HIGHEST_PRIORITYpublic static final int HIGHEST_PRIORITYHighest priority allowed for procedure calls (1)- See Also:
 
- 
LOWEST_PRIORITYpublic static final int LOWEST_PRIORITYLowest priority allowed for procedure calls (8)- See Also:
 
 
- 
- 
Constructor Details- 
Client2Configpublic Client2Config()Constructs a configuration with default values. Various methods can be used to override the defaults. You'll likely need authentication information (username and password) at a minimum.All configuration methods in Client2Configreturnthis, so calls can be chained.
 
- 
- 
Method Details- 
usernameSet username for connections to VoltDB.- Parameters:
- username- username
- Returns:
- this
 
- 
passwordSet cleartext password for connections to VoltDB.- Parameters:
- password- password
- Returns:
- this
 
- 
hashedPasswordSet hashed password for connections to VoltDB.- Parameters:
- password- hashed password
- Returns:
- this
 
- 
hashedPassword@Deprecated public Client2Config hashedPassword(String password, org.voltdb.client.ClientAuthScheme hashScheme) Deprecated.no longer useful since there is only one valid value forschemeSet hashed password for connections to VoltDB. The password was hashed using a specified hash scheme.- Parameters:
- password- hashed password
- hashScheme- hash scheme used to hash the password; must be HASH_256
- Returns:
- this
 
- 
authenticatedSubjectSets the authenticated subject to be used for connections to VoltDB. This can be used as an alternative to a username and password combination.- Parameters:
- subject- subject (- javax.security.auth.Subject)
- Returns:
- this
 
- 
loginContextCreates a new login context and authenticates the user, then adds the authenticated subject to this client configuration.See package javax.security.auth.loginfor details.- Parameters:
- name- as used as key to locate the login context entry
- Returns:
- this
- See Also:
 
- 
connectionSetupTimeoutSets the timeout for connection setup, including authentication to the server. A zero or negative value means there is no limit.- Parameters:
- timeout- the timeout interval
- unit- the units in which the timeout was expressed
- Returns:
- this
 
- 
connectionResponseTimeoutSets the connection response timeout. A zero or negative value means there is no limit.If no response has been received on a connection within the specified time, the connection will be considered lost. A 'ping' request will be periodically executed on an otherwise-idle connection in order to ensure keep the connection alive. - Parameters:
- timeout- the timeout interval
- unit- the units in which the timeout was expressed
- Returns:
- this
 
- 
procedureCallTimeoutSets the timeout for procedure calls. A zero or negative value means there is no limit.If a call has received no response from VoltDB in the specified time, it will be completed with a timeout error. - Parameters:
- timeout- the timeout interval
- unit- the units in which the timeout was expressed
- Returns:
- this
 
- 
clientRequestLimitSets the limit on the number of requests that can be pending in a client at any one time. Requests are pending from the time thatcallProcedure()is called, up to when the response has been delivered to the application or the call has failed.Calls which exceed this limit will be rejected by the API. This is an absolute limit on resource consumption. It should be set somewhat larger than the warning level established by a call to clientRequestBackpressureLevel(int, int)in order to give the application headroom to react to the warning.- Parameters:
- limit- the desired request limit
- Returns:
- this
- See Also:
 
- 
clientRequestBackpressureLevelSets levels for controlling backpressure notifications.When the pending count reaches the warning level or greater, the application is warned to slow down: backpressure starts. When the pending count subsequently drops to the resume level (or lower), the application is informed that it no longer needs to slow down: backpressure ends. For predictable operation, the implementation will adjust values such that: - resume level ≤ warning level
- warning level ≤ hard limit
 - Parameters:
- warning- the level at which the application is warned to slow down
- resume- the level at which application slow-down can end
- Returns:
- this
- See Also:
 
- 
outstandingTransactionLimitSets the limit on the number of transactions that can be outstanding at the VoltDB server at any one time. Requests are outstanding from the time they are handed over to the networking code, up to when the response is received.Requests will be queued in the Client2 API after this limit is reached, to avoid overwhelming the VoltDB cluster. - Parameters:
- limit- the desired request limit
- Returns:
- this
 
- 
transactionRateLimitLimits the rate at which transactions can be queued for transmission to the VoltDB server. This is intended for performance modelling, and is not recommended for production use.If the application is making requests to callProcedurein excess of the target rate, then the application's calling thread may block without a timeout, even when using asynchronous calls.By default there is no rate limiting. - Parameters:
- tpsLimit- target rate limit in transactions per second
- Returns:
- this
 
- 
networkBackpressureLevelThis setting controls the maximum number of requests that the Client2 API can have queued at the VoltDB network layer for a single connection. At that point, the network interface will backpressure the API; this backpressure is not directly visible to the application using the API, since the API has internal queueing.Transmission order is fixed before a request is queued to the network layer. Thus, setting this value too high can adversely affect the ability of high-priority requests to overtake lower-priority requests. VoltDB recommends changing the default only after careful measurement in a realistic scenario. - Parameters:
- level- the desired backpressure level
- Returns:
- this
 
- 
reconnectDelaySets delay times for attempts to reconnect failed connections. There are two settings: one for the time to wait before the first reconnect attempt, and the other for the time to wait between retries, if the first attempt fails.In typical use, the initial delay will be fairly small, in order to recover from a momentary glitch; the retryDelay will be somewhat longer. VoltDB recommends changing delay times from the defaults only when default settings have been shown to be problematic in your specific use-case. - Parameters:
- initialDelay- delay before first reconnect attempt
- retryDelay- delay between subsequent retries
- unit- time units used for both delay values
- Returns:
- this
 
- 
disableConnectionMgmtDisable automatic connection management.Normally, after the application connects to at least one VoltDB server using connectSyncorconnectAsync, the API will manage connections to the VoltDB cluster. Connections will be created to available cluster nodes as they are discovered, and failed connections will be reconnected when possible.The application can disable this, and assume all responsibility for making initial connections, and for recovery from loss of connection. - Returns:
- this
 
- 
requestPrioritySets the default priority for procedure calls from aClient2created using this configuration.The value given here can be overridden by individual procedure calls. The valid priority range is from HIGHEST_PRIORITYtoLOWEST_PRIORITY, inclusive. Higher priorities have lower numerical values.- Parameters:
- prio- priority
- Returns:
- this
 
- 
trustStoreFromPropertyFileConfigure a TLS/SSL trust store via a property file. The file must contain property entries for a trust store, in Java keystore (JKS), PKCS#12, or PEM format, containing one or more X.509 certificates. The trust store properties are:- trustStoretrust store file specification
- trustStorePasswordtrust store password (optional)
 The password is ignored for PEM files; for the other types, if supplied then it is used to check file integrity. Optionally, there may also be entries for a key store, which supplies a client private key and certificate for mutual TLS. This file can be a JKS, PKCS#12, or PEM file, containing a private key entry and an X.509 certificate chain. For PEM, the key is in PKCS#8 form. The key store properties are: - keyStorekey store file specification
- keyStorePasswordkey store password (required)
 If the path is missing or empty, a default is supplied as if defaultTrustStore()had been called.- Parameters:
- path- property file name
- Returns:
- this
- See Also:
 
- 
trustStoreFromFileA generalized routine to configure a TLS/SSL trust store, and in one case an optional key store, from a specified file.The file can be: - A Java keystore (JKS) or PKCS#12 file. No password is provided; the truststore file can still be opened but no integrity check is done.
- A PEM file containing X.509 certificate entries, functioning as a trust store.
- A properties file containing a path and optional password for a trust store file, and optionally a path and password for a key store file.
 If the file name is missing or empty then the installation default will be used, as if defaultTrustStore()had been called.- Parameters:
- path- file name
- Returns:
- this
- See Also:
 
- 
defaultTrustStoreConfigures trust store for TLS/SSL using installation defaults. The defaults are determined as follows:- If the system property javax.net.ssl.trustStoreis set, then its value, along with that ofjavax.net.ssl.trustStorePassword, will be used.
- If that is not set, then the Java default will be used based on where Java is installed, and a default password.
 - Returns:
- this
- See Also:
 
- If the system property 
- 
trustStoreConfigures trust store for TLS/SSL using a specified trust store file and an optional password. The trust store can be a Java keystore (JKS) or PKCS#12 binary file, or a PEM text file containing a sequence of X.509 certificates.The password only applies to JKS and PKCS#12 files, is optional, and if present is used only for an integrity check. A trust store contains no secret information. If the path is missing or empty, a default is supplied as if defaultTrustStore()had been called.- Parameters:
- path- trust store file specification
- password- optional trust store file password
- Returns:
- this
- See Also:
 
- 
trustStoreWithMutualAuthpublic Client2Config trustStoreWithMutualAuth(String trustPath, String trustPass, String keyPath, String keyPass) Configures trust store for TLS/SSL using a specified trust store file and an optional password, and a key store which may be used for mutual TLS, when required by the server.The trust store file can be in Java keystore (JKS), PKCS#12, or PEM format, containing one or more X.509 certificates. The password is ignored for PEM files; for the other file types, if supplied then it is used to check file integrity. The keystore file supplies a client private key and certificate for mutual TLS. This file can be a JKS, PKCS#12, or PEM file, containing a private key entry and an X.509 certificate chain. The password is required for JKS or PKCS#12; it is used to decrypt the private key. For PEM, the key is in PKCS#8 form, and the password is only needed if the key is encrypted. If either path is missing or empty, a default is used. - Parameters:
- trustPath- trust store file specification
- trustPass- optional trust store file password
- keyPath- key store file specification
- keyPass- key store file password
- Returns:
- this
- See Also:
 
- 
trustStoreWithMutualAuthpublic Client2Config trustStoreWithMutualAuth(String trustPath, String trustPass, String keyPath, String keyPass, String keyCertFile) Configures trust store for TLS/SSL using a specified trust store file and an optional password, and a key store which may be used for mutual TLS, when required by the server.This variation of trustStoreWithMutualAuthadds an argument for a separate cert file; it can be used when the key store file contains only the private key, not the certificate chain. Separate key and cert files are applicable only to the PEM format.- Parameters:
- trustPath- trust store file specification
- trustPass- optional trust store file password
- keyPath- key store file specification
- keyPass- key store file password
- keyCertFile- separate certificate file for key store
- Returns:
- this
- See Also:
 
- 
enableSSLEnables TLS/SSL for server connections. If a trust store has not already been configured, a default is supplied as ifdefaultTrustStore()had been called.- Returns:
- this
 
- 
enableSSLHostCheckIf TLS/SSL is enabled, this enables verification of the host identification (either dnsName or IP address) in the X.509 certificate's SubjectAlternativeName extension.- Returns:
- this
 
- 
connectFailureHandlerRegisters a handler for connection-establishment failures. This will be called when an attempt to connect to a VoltDB server fails.- Parameters:
- handler- a- Client2Notification.ConnectionStatus
- Returns:
- this
- See Also:
 
- 
connectionUpHandlerRegisters a handler for connection-up events. This will be called when an attempt to connect to a VoltDB server has successfully completed, including any necessary authentication.- Parameters:
- handler- a- Client2Notification.ConnectionStatus
- Returns:
- this
- See Also:
 
- 
connectionDownHandlerRegisters a handler for connection-down events. This will be called when a previously-up connection is lost for any reason.- Parameters:
- handler- a- Client2Notification.ConnectionStatus
- Returns:
- this
- See Also:
 
- 
lateResponseHandlerRegisters a handler for late server responses.- Parameters:
- handler- a- Client2Notification.LateResponse
- Returns:
- this
- See Also:
 
- 
requestBackpressureHandlerRegisters a handler to be notified about changes in request backpressure.Backpressure trigger levels are configurable via clientRequestBackpressureLevel(int, int).- Parameters:
- handler- a- Client2Notification.RequestBackpressure
- Returns:
- this
- See Also:
 
- 
errorLogHandlerRegisters an error-log handler.The Client2implementation may print messages on its standard error when certain unexpected situations arise. The application can choose to handle the message instead, perhaps writing to its own log.Applications are cautioned against attempting to interpret the text of a log message. The wording is subject to change without notice. - Parameters:
- handler- a- Client2Notification.ErrorLog
- Returns:
- this
- See Also:
 
- 
responseThreadCountSets the fixed number of 'response' threads to be available in the pool of such threads. Response messages from the VoltDB cluster are handled by these threads.This setting is only meaningful for the internal client response ExecutorService. If you provide a custom service byresponseExecutorServicethen the count specified here is not used.- Parameters:
- count- number of response threads to create
- Returns:
- this
 
- 
responseExecutorServiceProvides anExecutorServicewith which to completecallProcedurerequests. This replaces the default provided by theClient2interface.When a response message is received from the VoltDB cluster, it is handed over to a thread from this service for processing. The eventual setting of the call's CompletableFutureinto the 'completed' state will occur on this thread.The caller chooses whether or not Client2.close()will automatically execute ashutdownon the executor service.- Parameters:
- execService- an- ExecutorService
- stopOnClose- true to stop the service on client close
- Returns:
- this
 
- 
roundingModeEnables or disables the rounding mode in the client. This must match the rounding mode set in the server, which is set using system properties.- Parameters:
- enable- true iff rounding is enabled
- mode- the rounding mode (- java.math.RoundingMode)
- Returns:
- this
 
 
- 
scheme