public final class AsyncClientPolicy extends ClientPolicy
This class is not used by the new efficient asynchronous client. This class exists solely to provide compatibility with legacy applications.
Container object for client policy Command.
Modifier and Type | Field and Description |
---|---|
BatchPolicy |
asyncBatchPolicyDefault
Default batch policy that is used when asynchronous batch command's policy is null.
|
MaxCommandAction |
asyncMaxCommandAction
How to handle cases when the asynchronous maximum number of concurrent connections
have been reached.
|
int |
asyncMaxCommands
Maximum number of concurrent asynchronous commands that are active at any point in time.
|
QueryPolicy |
asyncQueryPolicyDefault
Default scan policy that is used when asynchronous query command's policy is null.
|
Policy |
asyncReadPolicyDefault
Default read policy that is used when asynchronous read command's policy is null.
|
ScanPolicy |
asyncScanPolicyDefault
Default scan policy that is used when asynchronous scan command's policy is null.
|
int |
asyncSelectorThreads
Number of selector threads used to process asynchronous network events.
|
int |
asyncSelectorTimeout
Maximum milliseconds to wait for an asynchronous network selector event.
|
ExecutorService |
asyncTaskThreadPool
Asynchronous socket read/user callback task thread pool.
|
WritePolicy |
asyncWritePolicyDefault
Default write policy that is used when asynchronous write command's policy is null.
|
authMode, batchPolicyDefault, clusterName, connPoolsPerNode, eventLoops, failIfNotConnected, forceSingleNode, infoPolicyDefault, ipMap, loginTimeout, maxConnsPerNode, maxSocketIdle, password, queryPolicyDefault, readPolicyDefault, requestProleReplicas, scanPolicyDefault, sharedThreadPool, tendInterval, threadPool, timeout, tlsPolicy, user, useServicesAlternate, writePolicyDefault
Constructor and Description |
---|
AsyncClientPolicy()
Default constructor.
|
public MaxCommandAction asyncMaxCommandAction
public int asyncMaxCommands
max open connections = asyncMaxCommands *
The maximum open connections should not exceed the total socket file descriptors available on the client machine. The socket file descriptors available can be determined by the following command:
ulimit -n
public int asyncSelectorTimeout
public int asyncSelectorThreads
public ExecutorService asyncTaskThreadPool
A variable sized thread pool can handle any amount of tasks.
// Daemon threads automatically terminate when the program terminates. asyncTaskThreadPool = Executors.newCachedThreadPool(new ThreadFactory() { public final Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } });If a fixed size thread pool is desired, the size should be the same as asyncMaxCommands.
asyncTaskThreadPool = Executors.newFixedThreadPool(asyncMaxCommands, new ThreadFactory() { public final Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } });Deadlock can occur when asyncTaskThreadPool is not defined, asyncMaxCommandAction equals BLOCK and there are many instances of nested async commands (one command triggers new commands in the user callback). It is imperative that asyncTaskThreadPool be defined if your application is using this scenario.
public Policy asyncReadPolicyDefault
public WritePolicy asyncWritePolicyDefault
public ScanPolicy asyncScanPolicyDefault
public QueryPolicy asyncQueryPolicyDefault
public BatchPolicy asyncBatchPolicyDefault
Copyright ? 2012–2018 Aerospike, Inc. All rights reserved.