Class ClientPolicy
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
Maximum number of asynchronous connections allowed per server node.int
Minimum number of asynchronous connections allowed per server node.Authentication mode.Default delete policy used in batch delete commands.Default parent policy used in batch write commands.Default parent policy used in batch read commands.Default user defined function policy used in batch UDF excecute commands.Default write policy used in batch operate commands.int
Cluster close timeout in milliseconds.Expected cluster name.int
Number of synchronous connection pools used for each node.int
The number of cluster tend iterations that defines the window formaxErrorRate
.Optional event loops to use in asynchronous commands.boolean
Should cluster instantiation fail if the client fails to connect to a seed or all the seed's peers.boolean
For testing purposes only.Default info policy that is used when info command's policy is null.A IP translation table is used in cases where different clients use different server IP addresses.TCP keep-alive configuration.int
Login timeout in milliseconds.int
Maximum number of synchronous connections allowed per server node.int
Maximum number of errors allowed per node pererrorRateWindow
before backoff algorithm throwsAerospikeException.Backoff
on database commands to that node.int
Maximum socket idle in seconds.int
Minimum number of synchronous connections allowed per server node.Password authentication to cluster.Default query policy that is used when query command's policy is null.boolean
Track server rack data.int
Rack where this client instance resides.List of acceptable racks in order of preference.Default read policy that is used when read command's policy is null.Default scan policy that is used when scan command's policy is null.boolean
Deprecated.int
Interval in milliseconds between cluster tends by maintenance thread.Deprecated.int
Cluster tend info call timeout in milliseconds.TLS secure connection policy for TLS enabled servers.Default transaction policy when rolling the transaction records forward (commit) or back (abort) in a batch.Default transaction policy when verifying record versions in a batch.User authentication to cluster.boolean
Should use "services-alternate" instead of "services" in info request during cluster tending.boolean
When validateClusterName is true andclusterName
is populated, verify that clusterName matches the cluster-name field in the service section in each server configuration.Default write policy that is used when write command's policy is null. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ClientPolicy
(ClientPolicy other) Copy client policy from another client policy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setAsyncMaxConnsPerNode
(int asyncMaxConnsPerNode) void
setAsyncMinConnsPerNode
(int asyncMinConnsPerNode) void
setAuthMode
(AuthMode authMode) void
setBatchDeletePolicyDefault
(BatchDeletePolicy batchDeletePolicyDefault) void
setBatchParentPolicyWriteDefault
(BatchPolicy batchParentPolicyWriteDefault) void
setBatchPolicyDefault
(BatchPolicy batchPolicyDefault) void
setBatchUDFPolicyDefault
(BatchUDFPolicy batchUDFPolicyDefault) void
setBatchWritePolicyDefault
(BatchWritePolicy batchWritePolicyDefault) void
setCloseTimeout
(int closeTimeout) void
setClusterName
(String clusterName) void
setConnPoolsPerNode
(int connPoolsPerNode) void
setErrorRateWindow
(int errorRateWindow) void
setEventLoops
(EventLoops eventLoops) void
setFailIfNotConnected
(boolean failIfNotConnected) void
setForceSingleNode
(boolean forceSingleNode) void
setInfoPolicyDefault
(InfoPolicy infoPolicyDefault) void
void
setKeepAlive
(TCPKeepAlive keepAlive) void
setLoginTimeout
(int loginTimeout) void
setMaxConnsPerNode
(int maxConnsPerNode) void
setMaxErrorRate
(int maxErrorRate) void
setMaxSocketIdle
(int maxSocketIdle) void
setMinConnsPerNode
(int minConnsPerNode) void
setPassword
(String password) void
setQueryPolicyDefault
(QueryPolicy queryPolicyDefault) void
setRackAware
(boolean rackAware) void
setRackId
(int rackId) void
setRackIds
(List<Integer> rackIds) void
setReadPolicyDefault
(Policy readPolicyDefault) void
setScanPolicyDefault
(ScanPolicy scanPolicyDefault) void
setSharedThreadPool
(boolean sharedThreadPool) void
setTendInterval
(int tendInterval) void
setThreadPool
(ExecutorService threadPool) void
setTimeout
(int timeout) void
setTlsPolicy
(TlsPolicy tlsPolicy) void
setTxnRollPolicyDefault
(TxnRollPolicy txnRollPolicyDefault) void
setTxnVerifyPolicyDefault
(TxnVerifyPolicy txnVerifyPolicyDefault) void
void
setUseServicesAlternate
(boolean useServicesAlternate) void
setValidateClusterName
(boolean validateClusterName) void
setWritePolicyDefault
(WritePolicy writePolicyDefault)
-
Field Details
-
eventLoops
Optional event loops to use in asynchronous commands.Default: null (async methods are disabled)
-
user
User authentication to cluster. Leave null for clusters running without restricted access.Default: null
-
password
Password authentication to cluster. The password will be stored by the client and sent to server in hashed format. Leave null for clusters running without restricted access.Default: null
-
clusterName
Expected cluster name. If populated andvalidateClusterName
is true, the clusterName must match the cluster-name field in the service section in each server configuration. This ensures that the specified seed nodes belong to the expected cluster on startup. If not, the client will refuse to add the node to the client's view of the cluster.Default: null
-
authMode
Authentication mode.Default: AuthMode.INTERNAL
-
timeout
public int timeoutCluster tend info call timeout in milliseconds. The timeout when opening a connection to the server node for the first time and when polling each node for cluster status.Default: 1000
-
loginTimeout
public int loginTimeoutLogin timeout in milliseconds. The timeout is used when user authentication is enabled and a node login is being performed.Default: 5000
-
closeTimeout
public int closeTimeoutCluster close timeout in milliseconds. Time to wait for pending async commands to complete whenAerospikeClient.close()
is called. If close() is called from an event loop thread, the wait is not applied because that would cause deadlock. The possible values are:- -1: Close cluster immediately
- 0: Wait indefinitely for pending async commands to complete before closing the cluster
- > 0: Wait milliseconds for pending async commands to complete before closing the cluster
-
minConnsPerNode
public int minConnsPerNodeMinimum number of synchronous connections allowed per server node. Preallocate min connections on client node creation. The client will periodically allocate new connections if count falls below min connections.Server proto-fd-idle-ms and client
maxSocketIdle
should be set to zero (no reap) if minConnsPerNode is greater than zero. Reaping connections can defeat the purpose of keeping connections in reserve for a future burst of activity.Default: 0
-
maxConnsPerNode
public int maxConnsPerNodeMaximum number of synchronous connections allowed per server node. Commands will go through retry logic and potentially fail with "ResultCode.NO_MORE_CONNECTIONS" if the maximum number of connections would be exceeded.The number of connections used per node depends on concurrent commands in progress plus sub-commands used for parallel multi-node commands (batch, scan, and query). One connection will be used for each command.
Default: 100
-
asyncMinConnsPerNode
public int asyncMinConnsPerNodeMinimum number of asynchronous connections allowed per server node. Preallocate min connections on client node creation. The client will periodically allocate new connections if count falls below min connections.Server proto-fd-idle-ms and client
maxSocketIdle
should be set to zero (no reap) if asyncMinConnsPerNode is greater than zero. Reaping connections can defeat the purpose of keeping connections in reserve for a future burst of activity.Default: 0
-
asyncMaxConnsPerNode
public int asyncMaxConnsPerNodeMaximum number of asynchronous connections allowed per server node. Commands will go through retry logic and potentially fail with "ResultCode.NO_MORE_CONNECTIONS" if the maximum number of connections would be exceeded.The number of connections used per node depends on concurrent commands in progress plus sub-commands used for parallel multi-node commands (batch, scan, and query). One connection will be used for each command.
If the value is -1, the value will be set to
maxConnsPerNode
.Default: -1 (Use maxConnsPerNode)
-
connPoolsPerNode
public int connPoolsPerNodeNumber of synchronous connection pools used for each node. Machines with 8 cpu cores or less usually need just one connection pool per node. Machines with a large number of cpu cores may have their synchronous performance limited by contention for pooled connections. Contention for pooled connections can be reduced by creating multiple mini connection pools per node.Default: 1
-
maxSocketIdle
public int maxSocketIdleMaximum socket idle in seconds. Socket connection pools will discard sockets that have been idle longer than the maximum.Connection pools are now implemented by a LIFO stack. Connections at the tail of the stack will always be the least used. These connections are checked for maxSocketIdle once every 30 tend iterations (usually 30 seconds).
If server's proto-fd-idle-ms is greater than zero, then maxSocketIdle should be at least a few seconds less than the server's proto-fd-idle-ms, so the client does not attempt to use a socket that has already been reaped by the server.
If server's proto-fd-idle-ms is zero (no reap), then maxSocketIdle should also be zero. Connections retrieved from a pool in commands will not be checked for maxSocketIdle when maxSocketIdle is zero. Idle connections will still be trimmed down from peak connections to min connections (minConnsPerNode and asyncMinConnsPerNode) using a hard-coded 55 second limit in the cluster tend thread.
Default: 0
-
maxErrorRate
public int maxErrorRateMaximum number of errors allowed per node pererrorRateWindow
before backoff algorithm throwsAerospikeException.Backoff
on database commands to that node. If maxErrorRate is zero, there is no error limit and the exception will never be thrown.The counted error types are any error that causes the connection to close (socket errors and client timeouts) and
ResultCode.DEVICE_OVERLOAD
.Default: 100
-
errorRateWindow
public int errorRateWindowThe number of cluster tend iterations that defines the window formaxErrorRate
. One tend iteration is defined astendInterval
plus the time to tend all nodes. At the end of the window, the error count is reset to zero and backoff state is removed on all nodes.Default: 1
-
tendInterval
public int tendIntervalInterval in milliseconds between cluster tends by maintenance thread.Default: 1000
-
failIfNotConnected
public boolean failIfNotConnectedShould cluster instantiation fail if the client fails to connect to a seed or all the seed's peers.If true, throw an exception if all seed connections fail or a seed is valid, but all peers from that seed are not reachable.
If false, a partial cluster will be created and the client will automatically connect to the remaining nodes when they become available.
Default: true
-
validateClusterName
public boolean validateClusterNameWhen validateClusterName is true andclusterName
is populated, verify that clusterName matches the cluster-name field in the service section in each server configuration. This ensures that the specified seed nodes belong to the expected cluster on startup. If not, the client will refuse to add the node to the client's view of the cluster.Default: true
-
readPolicyDefault
Default read policy that is used when read command's policy is null. -
writePolicyDefault
Default write policy that is used when write command's policy is null. -
scanPolicyDefault
Default scan policy that is used when scan command's policy is null. -
queryPolicyDefault
Default query policy that is used when query command's policy is null. -
batchPolicyDefault
Default parent policy used in batch read commands. Parent policy fields include socketTimeout, totalTimeout, maxRetries, etc... -
batchParentPolicyWriteDefault
Default parent policy used in batch write commands. Parent policy fields include socketTimeout, totalTimeout, maxRetries, etc... -
batchWritePolicyDefault
Default write policy used in batch operate commands. Write policy fields include generation, expiration, durableDelete, etc... -
batchDeletePolicyDefault
Default delete policy used in batch delete commands. -
batchUDFPolicyDefault
Default user defined function policy used in batch UDF excecute commands. -
txnVerifyPolicyDefault
Default transaction policy when verifying record versions in a batch. -
txnRollPolicyDefault
Default transaction policy when rolling the transaction records forward (commit) or back (abort) in a batch. -
infoPolicyDefault
Default info policy that is used when info command's policy is null. -
tlsPolicy
TLS secure connection policy for TLS enabled servers. TLS connections are only supported for AerospikeClient synchronous commands.Default: null (Use normal sockets)
-
keepAlive
TCP keep-alive configuration. If assigned, enable TCP keep-alive when using the native Netty epoll library.Default: null (Do not enable TCP keep-alive)
-
ipMap
A IP translation table is used in cases where different clients use different server IP addresses. This may be necessary when using clients from both inside and outside a local area network. Default is no translation.The key is the IP address returned from friend info requests to other servers. The value is the real IP address used to connect to the server.
Default: null (no IP address translation)
-
threadPool
Deprecated.This field is ignored and deprecated. The client now supports virtual threads and thread pools are no longer used. This field only exists to maintain api compatibility when switching between aerospike-client-jdk21 and aerospike-client-jdk8 packages. -
useServicesAlternate
public boolean useServicesAlternateShould use "services-alternate" instead of "services" in info request during cluster tending. "services-alternate" returns server configured external IP addresses that client uses to talk to nodes. "services-alternate" can be used in place of providing a client "ipMap".Default: false (use original "services" info request)
-
forceSingleNode
public boolean forceSingleNodeFor testing purposes only. Do not modify.Should the AerospikeClient instance communicate with the first seed node only instead of using the data partition map to determine which node to send the database command.
Default: false
-
rackAware
public boolean rackAwareTrack server rack data. This field is useful when directing read commands to the server node that contains the key and exists on the same rack as the client. This serves to lower cloud provider costs when nodes are distributed across different racks/data centers.rackId
orrackIds
,Replica.PREFER_RACK
and server rack configuration must also be set to enable this functionality.Default: false
-
rackId
public int rackIdRack where this client instance resides. IfrackIds
is set, rackId is ignored.rackAware
,Replica.PREFER_RACK
and server rack configuration must also be set to enable this functionality.Default: 0
-
rackIds
List of acceptable racks in order of preference. Nodes in rackIds[0] are chosen first. If a node is not found in rackIds[0], then nodes in rackIds[1] are searched, and so on. If rackIds is set,rackId
is ignored.rackAware
,Replica.PREFER_RACK
and server rack configuration must also be set to enable this functionality.Default: null
-
-
Constructor Details
-
ClientPolicy
Copy client policy from another client policy. -
ClientPolicy
public ClientPolicy()Default constructor.
-
-
Method Details
-
setEventLoops
-
setUser
-
setPassword
-
setClusterName
-
setAuthMode
-
setTimeout
public void setTimeout(int timeout) -
setLoginTimeout
public void setLoginTimeout(int loginTimeout) -
setCloseTimeout
public void setCloseTimeout(int closeTimeout) -
setMinConnsPerNode
public void setMinConnsPerNode(int minConnsPerNode) -
setMaxConnsPerNode
public void setMaxConnsPerNode(int maxConnsPerNode) -
setAsyncMinConnsPerNode
public void setAsyncMinConnsPerNode(int asyncMinConnsPerNode) -
setAsyncMaxConnsPerNode
public void setAsyncMaxConnsPerNode(int asyncMaxConnsPerNode) -
setConnPoolsPerNode
public void setConnPoolsPerNode(int connPoolsPerNode) -
setMaxSocketIdle
public void setMaxSocketIdle(int maxSocketIdle) -
setMaxErrorRate
public void setMaxErrorRate(int maxErrorRate) -
setErrorRateWindow
public void setErrorRateWindow(int errorRateWindow) -
setTendInterval
public void setTendInterval(int tendInterval) -
setFailIfNotConnected
public void setFailIfNotConnected(boolean failIfNotConnected) -
setValidateClusterName
public void setValidateClusterName(boolean validateClusterName) -
setReadPolicyDefault
-
setWritePolicyDefault
-
setScanPolicyDefault
-
setQueryPolicyDefault
-
setBatchPolicyDefault
-
setBatchParentPolicyWriteDefault
-
setBatchWritePolicyDefault
-
setBatchDeletePolicyDefault
-
setBatchUDFPolicyDefault
-
setTxnVerifyPolicyDefault
-
setTxnRollPolicyDefault
-
setInfoPolicyDefault
-
setTlsPolicy
-
setKeepAlive
-
setIpMap
-
setThreadPool
-
setUseServicesAlternate
public void setUseServicesAlternate(boolean useServicesAlternate) -
setForceSingleNode
public void setForceSingleNode(boolean forceSingleNode) -
setRackAware
public void setRackAware(boolean rackAware) -
setRackId
public void setRackId(int rackId) -
setRackIds
-