com.aerospike.client.policy
Class ClientPolicy

java.lang.Object
  extended by com.aerospike.client.policy.ClientPolicy
Direct Known Subclasses:
AsyncClientPolicy

public class ClientPolicy
extends Object

Container object for client policy Command.


Field Summary
 boolean failIfNotConnected
          Throw exception if host connection fails during addHost().
 int maxSocketIdle
          Maximum socket idle in seconds.
 int maxThreads
          Estimate of incoming threads concurrently using synchronous methods in the client instance.
 boolean sharedThreadPool
          Is threadPool shared between other client instances or classes.
 ExecutorService threadPool
          Underlying thread pool used in batch, scan, and query commands.
 int timeout
          Initial host connection timeout in milliseconds.
 
Constructor Summary
ClientPolicy()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeout

public int timeout
Initial host connection timeout in milliseconds. The timeout when opening a connection to the server host for the first time.


maxThreads

public int maxThreads
Estimate of incoming threads concurrently using synchronous methods in the client instance. This field is used to size the synchronous connection pool for each server node.


maxSocketIdle

public int maxSocketIdle
Maximum socket idle in seconds. Socket connection pools will discard sockets that have been idle longer than the maximum.


failIfNotConnected

public boolean failIfNotConnected
Throw exception if host connection fails during addHost().


threadPool

public ExecutorService threadPool
Underlying thread pool used in batch, scan, and query commands. These commands are often sent to multiple server nodes in parallel threads. A thread pool improves performance because threads do not have to be created/destroyed for each command. The default, null, indicates that the following daemon thread pool will be used:
 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.


sharedThreadPool

public boolean sharedThreadPool
Is threadPool shared between other client instances or classes. If threadPool is not shared (default), threadPool will be shutdown when the client instance is closed.

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.

Constructor Detail

ClientPolicy

public ClientPolicy()


Copyright © 2012–2014 Aerospike, Inc. All rights reserved.