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.
|
int |
closeTimeout
Cluster close timeout in milliseconds.
|
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.
|
boolean |
validateClusterName
When validateClusterName is true and
clusterName is populated, verify that
clusterName matches the cluster-name field in the service section in each server
configuration. |
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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 |
setIpMap(Map<String,String> ipMap) |
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 |
setUser(String user) |
void |
setUseServicesAlternate(boolean useServicesAlternate) |
void |
setValidateClusterName(boolean validateClusterName) |
void |
setWritePolicyDefault(WritePolicy writePolicyDefault) |
public EventLoops eventLoops
Default: null (async methods are disabled)
public String user
Default: null
public String password
Default: null
public String clusterName
validateClusterName 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
public AuthMode authMode
Default: AuthMode.INTERNAL
public int timeout
Default: 1000
public int loginTimeout
Default: 5000
public int closeTimeout
AerospikeClient.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:
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: 100
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: 0
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: 100
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 boolean validateClusterName
clusterName 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
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()
public void setEventLoops(EventLoops eventLoops)
public void setUser(String user)
public void setPassword(String password)
public void setClusterName(String clusterName)
public void setAuthMode(AuthMode authMode)
public void setTimeout(int timeout)
public void setLoginTimeout(int loginTimeout)
public void setCloseTimeout(int closeTimeout)
public void setMinConnsPerNode(int minConnsPerNode)
public void setMaxConnsPerNode(int maxConnsPerNode)
public void setAsyncMinConnsPerNode(int asyncMinConnsPerNode)
public void setAsyncMaxConnsPerNode(int asyncMaxConnsPerNode)
public void setConnPoolsPerNode(int connPoolsPerNode)
public void setMaxSocketIdle(int maxSocketIdle)
public void setMaxErrorRate(int maxErrorRate)
public void setErrorRateWindow(int errorRateWindow)
public void setTendInterval(int tendInterval)
public void setFailIfNotConnected(boolean failIfNotConnected)
public void setValidateClusterName(boolean validateClusterName)
public void setReadPolicyDefault(Policy readPolicyDefault)
public void setWritePolicyDefault(WritePolicy writePolicyDefault)
public void setScanPolicyDefault(ScanPolicy scanPolicyDefault)
public void setQueryPolicyDefault(QueryPolicy queryPolicyDefault)
public void setBatchPolicyDefault(BatchPolicy batchPolicyDefault)
public void setBatchParentPolicyWriteDefault(BatchPolicy batchParentPolicyWriteDefault)
public void setBatchWritePolicyDefault(BatchWritePolicy batchWritePolicyDefault)
public void setBatchDeletePolicyDefault(BatchDeletePolicy batchDeletePolicyDefault)
public void setBatchUDFPolicyDefault(BatchUDFPolicy batchUDFPolicyDefault)
public void setInfoPolicyDefault(InfoPolicy infoPolicyDefault)
public void setTlsPolicy(TlsPolicy tlsPolicy)
public void setKeepAlive(TCPKeepAlive keepAlive)
public void setThreadPool(ExecutorService threadPool)
public void setSharedThreadPool(boolean sharedThreadPool)
public void setUseServicesAlternate(boolean useServicesAlternate)
public void setForceSingleNode(boolean forceSingleNode)
public void setRackAware(boolean rackAware)
public void setRackId(int rackId)
Copyright © 2012–2024 Aerospike, Inc. All rights reserved.