public final class Txn extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Txn.State
Transaction state.
|
| Constructor and Description |
|---|
Txn()
Create transaction, assign random transaction id and initialize reads/writes hashmaps with
default capacities.
|
Txn(int readsCapacity,
int writesCapacity)
Create transaction, assign random transaction id and initialize reads/writes hashmaps with
given capacities.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear transaction.
|
boolean |
closeMonitor()
Return if the transaction monitor record should be closed/deleted.
|
int |
getDeadline()
Get transaction deadline.
|
long |
getId()
Return transaction ID.
|
boolean |
getInDoubt()
Return if transaction is inDoubt.
|
String |
getNamespace()
Return transaction namespace.
|
Set<Map.Entry<Key,Long>> |
getReads()
Get all read keys and their versions.
|
Long |
getReadVersion(Key key)
Get record version for a given key.
|
Txn.State |
getState()
Return transaction state.
|
int |
getTimeout()
Return transaction timeout in seconds.
|
Set<Key> |
getWrites()
Get all write keys and their versions.
|
boolean |
monitorExists()
Does transaction monitor record exist.
|
void |
onRead(Key key,
Long version)
Process the results of a record read.
|
void |
onWrite(Key key,
Long version,
int resultCode)
Process the results of a record write.
|
void |
onWriteInDoubt(Key key)
Add key to write hash when write command is in doubt (usually caused by timeout).
|
void |
setDeadline(int deadline)
Set transaction deadline.
|
void |
setInDoubt(boolean inDoubt)
Set transaction inDoubt flag.
|
void |
setNamespace(String ns)
Set transaction namespace only if doesn't already exist.
|
void |
setState(Txn.State state)
Set transaction state.
|
void |
setTimeout(int timeout)
Set transaction timeout in seconds.
|
void |
verifyCommand()
Verify that the transaction state allows future commands.
|
public Txn()
The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.
public Txn(int readsCapacity,
int writesCapacity)
The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.
readsCapacity - expected number of record reads in the transaction. Minimum value is 16.writesCapacity - expected number of record writes in the transaction. Minimum value is 16.public long getId()
public void setTimeout(int timeout)
If the transaction timeout is zero, the server configuration mrt-duration is used. The default mrt-duration is 10 seconds.
public int getTimeout()
public void verifyCommand()
public void onRead(Key key, Long version)
public void onWrite(Key key, Long version, int resultCode)
public void onWriteInDoubt(Key key)
public void setNamespace(String ns)
public String getNamespace()
public void setDeadline(int deadline)
public int getDeadline()
public boolean closeMonitor()
public boolean monitorExists()
public void setState(Txn.State state)
public Txn.State getState()
public void setInDoubt(boolean inDoubt)
public boolean getInDoubt()
public void clear()
Copyright © 2012–2025 Aerospike, Inc. All rights reserved.