public class ClientConfig
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
ENABLE_SSL_FOR_TEST |
Constructor and Description |
---|
ClientConfig()
Configuration for a client with no authentication credentials.
|
ClientConfig(java.lang.String username,
java.lang.String password)
Configuration for a client that specifies cleartext authentication credentials.
|
ClientConfig(java.lang.String username,
java.lang.String password,
boolean cleartext,
ClientStatusListenerExt listener)
Configuration for a client that specifies authentication credentials, the password
being optionally hashed prior to the call.
|
ClientConfig(java.lang.String username,
java.lang.String password,
boolean cleartext,
ClientStatusListenerExt listener,
org.voltdb.client.ClientAuthScheme scheme)
Configuration for a client that specifies authentication credentials, the password
being optionally hashed prior to the call.
|
ClientConfig(java.lang.String username,
java.lang.String password,
ClientStatusListenerExt listener)
Configuration for a client that specifies cleartext authentication credentials.
|
ClientConfig(java.lang.String username,
java.lang.String password,
ClientStatusListenerExt listener,
org.voltdb.client.ClientAuthScheme scheme)
Configuration for a client that specifies cleartext authentication credentials.
|
ClientConfig(javax.security.auth.Subject subject,
ClientStatusListenerExt listener)
Configuration for a client that specifies an already authenticated
Subject . |
Modifier and Type | Method and Description |
---|---|
void |
enableKerberosAuthentication(java.lang.String loginContextEntryKey)
Enable Kerberos authentication, using the provided JAAS login context
entry key to get the authentication credentials held by the caller.
|
void |
enableKerberosAuthentication(javax.security.auth.Subject subject)
Enable Kerberos authentication with the provided subject credentials.
|
void |
enableSSL()
Enables SSL with previously-configured trust store.
|
int[] |
getBackpressureQueueThresholds()
Get thresholds for backpressure reporting, as set by
setBackpressureQueueThresholds(int, int) . |
int |
getMaxOutstandingTxns()
Returns the maximum number of outstanding requests as set by
setMaxOutstandingTxns(int) . |
long |
getNonblockingAsync()
Returns non-blocking async setting, as established by
a prior
setNonblockingAsync() . |
void |
setBackpressureQueueThresholds(int reqLimit,
int byteLimit)
Set thresholds for backpressure reporting based on pending
request count and pending byte count.
|
void |
setClientAffinity(boolean on)
Deprecated.
client affinity is now always
true : transactions are always
routed to the correct master partition improving latency and throughput.
(Deprecated in v11.0, 2021-03-23) |
void |
setConnectionResponseTimeout(long ms)
Set the timeout for reading from a connection.
|
void |
setHeavyweight(boolean heavyweight)
Specifies that the client wants additional network threads.
|
void |
setInitialConnectionRetryInterval(long ms)
Set the initial connection retry interval for automatic reconnection.
|
void |
setMaxConnectionRetryInterval(long ms)
Set the maximum connection retry interval.
|
void |
setMaxOutstandingTxns(int maxOutstanding)
Set the maximum number of outstanding requests that will be submitted before
blocking.
|
void |
setMaxTransactionsPerSecond(int maxTxnsPerSecond)
Set a limit on the number of transactions that can be executed per second.
|
void |
setNonblockingAsync()
Sets nonblocking mode for asynchronous procedure invocations.
|
void |
setNonblockingAsync(long blockingTimeout)
Sets nonblocking mode for asynchronous procedure invocations, with provision
for user-supplied blocking time limit.
|
void |
setProcedureCallTimeout(long ms)
Set the timeout for procedure calls.
|
void |
setReconnectOnConnectionLoss(boolean on)
Deprecated.
prefer using a topology-change-aware client, which
provides more automatic handling of connections to VoltDB cluster
nodes.
(Deprecated in v11.1, 2021-07-30) |
void |
setRequestPriority(int prio)
Sets the request priority for all procedure calls from
a
Client created using this configuration. |
static void |
setRoundingConfig(boolean isEnabled,
java.math.RoundingMode mode)
Enable or disable the rounding mode in the client.
|
void |
setSendReadsToReplicasByDefault(boolean on)
Deprecated.
no longer meaningful: reads are always sent
to the leader; sending to a replica would not have resulted
in better performance.
(Deprecated in v11.0, 2021-04-16) |
void |
setTopologyChangeAware(boolean enabled)
Configures the client so that it attempts to connect to all nodes in
the cluster as they are discovered, and will reconnect if those connections fail.
|
void |
setTrustStore(java.lang.String pathToTrustStore,
java.lang.String trustStorePassword)
Configure trust store with specified path and password.
|
void |
setTrustStoreConfigFromDefault()
Configure trust store from default file with default password.
|
void |
setTrustStoreConfigFromPropertyFile(java.lang.String propFN)
Configure trust store via a property file.
|
public ClientConfig()
public ClientConfig(java.lang.String username, java.lang.String password)
username
- Cleartext username.password
- Cleartext password.public ClientConfig(java.lang.String username, java.lang.String password, ClientStatusListenerExt listener)
username
- Cleartext username.password
- Cleartext password.listener
- ClientStatusListenerExt
implementation to receive callbacks.public ClientConfig(java.lang.String username, java.lang.String password, ClientStatusListenerExt listener, org.voltdb.client.ClientAuthScheme scheme)
username
- Cleartext username.password
- Cleartext password.listener
- ClientStatusListenerExt
implementation to receive callbacks.scheme
- Client password hash scheme.public ClientConfig(java.lang.String username, java.lang.String password, boolean cleartext, ClientStatusListenerExt listener)
username
- Cleartext username.password
- A cleartext or hashed password.cleartext
- Whether the password is hashed.listener
- ClientStatusListenerExt
implementation to receive callbacks.public ClientConfig(javax.security.auth.Subject subject, ClientStatusListenerExt listener)
Subject
.subject
- an authenticated Subject
.listener
- ClientStatusListenerExt
implementation to receive callbacks.public ClientConfig(java.lang.String username, java.lang.String password, boolean cleartext, ClientStatusListenerExt listener, org.voltdb.client.ClientAuthScheme scheme)
username
- Cleartext username.password
- A cleartext or hashed password.cleartext
- Whether the password is hashed.listener
- ClientStatusListenerExt
implementation to receive callbacks.scheme
- Client password hash schemepublic void setProcedureCallTimeout(long ms)
If the timeout expires before the procedure call could even be queued for transmission, because of backpressure:
ProcCallException
. The response
status will be ClientResponse.GRACEFUL_FAILURE
.
false
.
If the timeout expires after the call is queued for transmission:
ProcCallException
. The response
status will be ClientResponse.CONNECTION_TIMEOUT
.
ClientResponse.CONNECTION_TIMEOUT
.
Note that while specified in mSec, this timeout is only accurate to within a second or so.
ms
- Timeout value in milliseconds.public void setConnectionResponseTimeout(long ms)
The default timeout is 2 minutes. A zero or negative value indicates no timeout.
Note that while specified in mSec, this timeout is only accurate to within a second or so.
ms
- Timeout value in milliseconds.public void setHeavyweight(boolean heavyweight)
By default a single network thread is created to do IO and invoke callbacks.
When heavyweight
is set to true, additional threads are
created. This results in multiple connections to each server.
The number of network threads depends on the number of processors available.
Specifically, there will be Runtime.getRuntime().availableProcessors() / 2
threads.
heavyweight
- Whether to create additional threads for high IO or
high processing workloads.public void setMaxOutstandingTxns(int maxOutstanding)
maxOutstanding
- The maximum outstanding transactions before calls to
Client.callProcedure(ProcedureCallback, String, Object...)
will block
or return false (depending on settings). Use 0 to reset to default.public int getMaxOutstandingTxns()
setMaxOutstandingTxns(int)
.public void setMaxTransactionsPerSecond(int maxTxnsPerSecond)
Usage notes:
The limit should be less than 1,073,741,823 (half of Integer.MAX_VALUE
);
larger values disable rate-limiting. The default is Integer.MAX_VALUE
.
Transactions will not be timed out while they are stalled waiting for the average rate to permit transmission.
You cannot use setMaxTransactionsPerSecond
when
setNonblockingAsync
is in effect, since rate-limiting
potentially needs to block.
maxTxnsPerSecond
- Requested limit in transaction per second.public void setNonblockingAsync()
The default behavior for queueing of asynchronous procedure invocations is to block until it is possible to queue the invocation. If non-blocking async is configured, then an async callProcedure will return immediately if it is not possible to queue the procedure invocation due to backpressure. There is no effect on the synchronous variants of callProcedure.
Performance is sometimes improved if the callProcedure is permitted to block for a short while, say a few hundred microseconds, to ride out a short blip in backpressure. By default, this timeout is set to 500 microseconds.
Not supported if rate-limiting has been configured by setMaxTransactionsPerSecond.
public void setNonblockingAsync(long blockingTimeout)
setNonblockingAsync()
.blockingTimeout
- limit on blocking time, in nanoseconds; zero
if immediate return is desired.public long getNonblockingAsync()
setNonblockingAsync()
.public void setBackpressureQueueThresholds(int reqLimit, int byteLimit)
Reducing limit below current queue length will not cause backpressure indication until next callProcedure.
reqLimit
- request limit, greater than 0 for actual
limit, 0 to reset to defaultbyteLimit
- byte limit, greater than 0 for actual
limit, 0 to reset to defaultpublic int[] getBackpressureQueueThresholds()
setBackpressureQueueThresholds(int, int)
.@Deprecated public void setClientAffinity(boolean on)
true
: transactions are always
routed to the correct master partition improving latency and throughput.
(Deprecated in v11.0, 2021-03-23)
on
- unusedpublic void setTopologyChangeAware(boolean enabled)
The interval between retries is subject to exponential backoff
between user-supplied limits.
See setInitialConnectionRetryInterval(long)
and setMaxConnectionRetryInterval(long)
.
enabled
- Enable or disable the topology awareness feature.@Deprecated public void setSendReadsToReplicasByDefault(boolean on)
(Deprecated in v11.0, 2021-04-16)
on
- unused@Deprecated public void setReconnectOnConnectionLoss(boolean on)
(Deprecated in v11.1, 2021-07-30)
setInitialConnectionRetryInterval(long)
and setMaxConnectionRetryInterval(long)
.
on
- Enable or disable the reconnection feature. Default is off.setTopologyChangeAware(boolean)
public void setInitialConnectionRetryInterval(long ms)
ms
- initial connection retry interval in milliseconds.public void setMaxConnectionRetryInterval(long ms)
ms
- max connection retry interval in milliseconds.public void enableKerberosAuthentication(javax.security.auth.Subject subject)
subject
- Identity of the authenticated user.public void enableKerberosAuthentication(java.lang.String loginContextEntryKey)
loginContextEntryKey
- JAAS login context config entry designationpublic static void setRoundingConfig(boolean isEnabled, java.math.RoundingMode mode)
isEnabled
- True iff rounding is enabled.mode
- The rounding mode, with values taken from java.math.RoundingMode.public void setTrustStore(java.lang.String pathToTrustStore, java.lang.String trustStorePassword)
pathToTrustStore
- file specification for the trust storetrustStorePassword
- trust store key file passwordpublic void setTrustStoreConfigFromPropertyFile(java.lang.String propFN)
propFN
- property file name containing trust store properties:
trustStore
trust store file specification
trustStorePassword
trust store password
public void setTrustStoreConfigFromDefault()
public void enableSSL()
public void setRequestPriority(int prio)
Client
created using this configuration.
This will be used only if priorities are enabled by the VoltDB cluster, and then it affects the order in which requests are dispatched.
The valid priority range is from 1 to 8, inclusive. Higher priorities have lower numerical values.
prio
- priority