public class Policy extends Object
Modifier and Type | Field and Description |
---|---|
ConsistencyLevel |
consistencyLevel
How replicas should be consulted in a read operation to provide the desired
consistency guarantee.
|
int |
maxRetries
Maximum number of retries before aborting the current transaction.
|
Priority |
priority
Transaction policy attributes used in all database commands.
|
Replica |
replica
Send read commands to the node containing the key's partition replica type.
|
boolean |
retryOnTimeout
Should the client retry a command if the timeout is reached.
|
boolean |
sendKey
Send user defined key in addition to hash digest on both reads and writes.
|
int |
sleepBetweenRetries
Milliseconds to sleep between retries.
|
int |
timeout
Total transaction timeout in milliseconds for both client and server.
|
int |
timeoutDelay
Delay milliseconds after transaction timeout before closing socket in async mode only.
|
public Priority priority
public ConsistencyLevel consistencyLevel
Default: ConsistencyLevel.CONSISTENCY_ONE
public Replica replica
Default: Replica.MASTER
public int timeout
The timeout is also used as a socket timeout. Default: 0 (no timeout).
public int timeoutDelay
This field delays the closing of the socket to give the transaction more time to complete in the hope that the socket can be reused. This is helpful when timeouts are aggressive and a certain percentage of timeouts is expected.
The user is still notified of the timeout in async mode at the original timeout value. The transaction's async timer is then reset to this delay and the transaction is allowed to continue. If the transactions succeeds within the delay, then the socket is placed back on the pool and the transaction response is discarded. Otherwise, the socket must be closed.
This field is ignored in sync mode because control must be returned back to user on timeout and there is no currently available thread pool to process the delay.
Default: 0 (no delay, connection closed on timeout)
public int maxRetries
Default: 1
public int sleepBetweenRetries
Default: 500ms
public boolean retryOnTimeout
If false, throw timeout exception when the timeout has been reached. Note that retries can still occur if a command fails on a network error before the timeout has been reached.
If true, retry command with same timeout when the timeout has been reached. The maximum number of retries is defined by maxRetries. Note that retries in async mode can only be made if timeoutDelay is zero. Otherwise, deadlock would have been possible.
Default: false
public boolean sendKey
Default: false (do not send the user defined key)
public Policy(Policy other)
public Policy()
Copyright © 2012–2017 Aerospike, Inc. All rights reserved.