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 used when user/password is defined.
|
BatchPolicy |
batchPolicyDefault
Default batch policy that is used when batch command's policy is null.
|
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
Throw exception if all seed connections fail on cluster instantiation.
|
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.
|
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
Initial host connection 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
Default: true
public Policy readPolicyDefault
public WritePolicy writePolicyDefault
public ScanPolicy scanPolicyDefault
public QueryPolicy queryPolicyDefault
public BatchPolicy batchPolicyDefault
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
, Replica.PREFER_RACK
and server rack
configuration must also be set to enable this functionality.
Default: false
public int rackId
rackAware
, Replica.PREFER_RACK
and server rack
configuration must also be set to enable this functionality.
Default: 0
public ClientPolicy(ClientPolicy other)
public ClientPolicy()
Copyright © 2012–2021 Aerospike, Inc. All rights reserved.