public class ClientPolicy extends Object
Modifier and Type | Field and Description |
---|---|
int |
asyncMaxConnsPerNode
Maximum number of asynchronous connections allowed per server node.
|
int |
asyncMinConnsPerNode
Minimum number of asynchronous connections allowed per server node.
|
AuthMode |
authMode
Authentication mode.
|
BatchDeletePolicy |
batchDeletePolicyDefault
Default delete policy used in batch delete commands.
|
BatchPolicy |
batchParentPolicyWriteDefault
Default parent policy used in batch write commands.
|
BatchPolicy |
batchPolicyDefault
Default parent policy used in batch read commands.
|
BatchUDFPolicy |
batchUDFPolicyDefault
Default user defined function policy used in batch UDF excecute commands.
|
BatchWritePolicy |
batchWritePolicyDefault
Default write policy used in batch operate commands.
|
String |
clusterName
Expected cluster name.
|
int |
connPoolsPerNode
Number of synchronous connection pools used for each node.
|
int |
errorRateWindow
The number of cluster tend iterations that defines the window for
maxErrorRate . |
EventLoops |
eventLoops
Optional event loops to use in asynchronous commands.
|
boolean |
failIfNotConnected
Should cluster instantiation fail if the client fails to connect to a seed or
all the seed's peers.
|
boolean |
forceSingleNode
For testing purposes only.
|
InfoPolicy |
infoPolicyDefault
Default info policy that is used when info command's policy is null.
|
Map<String,String> |
ipMap
A IP translation table is used in cases where different clients use different server
IP addresses.
|
TCPKeepAlive |
keepAlive
TCP keep-alive configuration.
|
int |
loginTimeout
Login timeout in milliseconds.
|
int |
maxConnsPerNode
Maximum number of synchronous connections allowed per server node.
|
int |
maxErrorRate
Maximum number of errors allowed per node per
errorRateWindow before backoff
algorithm throws AerospikeException.Backoff on database
commands to that node. |
int |
maxSocketIdle
Maximum socket idle in seconds.
|
int |
minConnsPerNode
Minimum number of synchronous connections allowed per server node.
|
String |
password
Password authentication to cluster.
|
QueryPolicy |
queryPolicyDefault
Default query policy that is used when query command's policy is null.
|
boolean |
rackAware
Track server rack data.
|
int |
rackId
Rack where this client instance resides.
|
List<Integer> |
rackIds
List of acceptable racks in order of preference.
|
Policy |
readPolicyDefault
Default read policy that is used when read command's policy is null.
|
ScanPolicy |
scanPolicyDefault
Default scan policy that is used when scan command's policy is null.
|
boolean |
sharedThreadPool
Is threadPool shared between other client instances or classes.
|
int |
tendInterval
Interval in milliseconds between cluster tends by maintenance thread.
|
ExecutorService |
threadPool
Underlying thread pool used in synchronous batch, scan, and query commands.
|
int |
timeout
Cluster tend info call timeout in milliseconds.
|
TlsPolicy |
tlsPolicy
TLS secure connection policy for TLS enabled servers.
|
String |
user
User authentication to cluster.
|
boolean |
useServicesAlternate
Should use "services-alternate" instead of "services" in info request during cluster
tending.
|
WritePolicy |
writePolicyDefault
Default write policy that is used when write command's policy is null.
|
Constructor and Description |
---|
ClientPolicy()
Default constructor.
|
ClientPolicy(ClientPolicy other)
Copy client policy from another client policy.
|
public EventLoops eventLoops
Default: null (async methods are disabled)
public String user
Default: null
public String password
Default: null
public String clusterName
Default: null
public AuthMode authMode
Default: AuthMode.INTERNAL
public int timeout
Default: 1000
public int loginTimeout
Default: 5000
public int minConnsPerNode
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
public int maxConnsPerNode
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: 300
public int asyncMinConnsPerNode
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
public int asyncMaxConnsPerNode
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)
public int connPoolsPerNode
Default: 1
public int maxSocketIdle
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 transactions 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: 55
public int maxErrorRate
errorRateWindow
before backoff
algorithm throws AerospikeException.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: 0
public int errorRateWindow
maxErrorRate
.
One tend iteration is defined as tendInterval
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
public int tendInterval
Default: 1000
public boolean failIfNotConnected
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
public Policy readPolicyDefault
public WritePolicy writePolicyDefault
public ScanPolicy scanPolicyDefault
public QueryPolicy queryPolicyDefault
public BatchPolicy batchPolicyDefault
public BatchPolicy batchParentPolicyWriteDefault
public BatchWritePolicy batchWritePolicyDefault
public BatchDeletePolicy batchDeletePolicyDefault
public BatchUDFPolicy batchUDFPolicyDefault
public InfoPolicy infoPolicyDefault
public TlsPolicy tlsPolicy
Default: null (Use normal sockets)
public TCPKeepAlive keepAlive
Default: null (Do not enable TCP keep-alive)
public Map<String,String> ipMap
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)
public ExecutorService threadPool
threadPool = Executors.newCachedThreadPool(new ThreadFactory() { public final Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } });Daemon threads automatically terminate when the program terminates.
Default: null (use Executors.newCachedThreadPool)
public boolean sharedThreadPool
If threadPool is shared, threadPool will not be shutdown when the client instance is closed. This shared threadPool should be shutdown manually before the program terminates. Shutdown is recommended, but not absolutely required if threadPool is constructed to use daemon threads.
Default: false
public boolean useServicesAlternate
Default: false (use original "services" info request)
public boolean forceSingleNode
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
public boolean rackAware
rackId
or rackIds
, Replica.PREFER_RACK
and server rack configuration must also be set to enable this functionality.
Default: false
public int rackId
rackIds
is set, rackId is ignored.
rackAware
, Replica.PREFER_RACK
and server rack
configuration must also be set to enable this functionality.
Default: 0
public List<Integer> rackIds
rackId
is ignored.
rackAware
, Replica.PREFER_RACK
and server rack
configuration must also be set to enable this functionality.
Default: null
public ClientPolicy(ClientPolicy other)
public ClientPolicy()
Copyright © 2012–2022 Aerospike, Inc. All rights reserved.