public final class Transaction
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
STATUS_CLOSED
The status of a closed transaction (committed or rolled back).
|
static int |
STATUS_COMMITTED
The status of a transaction that has been logically committed or rather
marked as committed, because it might be still listed among prepared,
if it was prepared for commit.
|
static int |
STATUS_OPEN
The status of an open transaction.
|
static int |
STATUS_PREPARED
The status of a prepared transaction.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowNonRepeatableRead()
Whether this transaction has isolation level READ_COMMITTED or below.
|
void |
commit()
Commit the transaction.
|
int |
getBlockerId() |
java.util.Iterator<TransactionStore.Change> |
getChanges(long savepointId)
Get the list of changes, starting with the latest change, up to the
given savepoint (in reverse order than they occurred).
|
int |
getId() |
IsolationLevel |
getIsolationLevel()
Returns the isolation level of this transaction.
|
java.lang.String |
getName() |
long |
getSequenceNum() |
int |
getStatus() |
boolean |
hasChanges()
Determine if any database changes were made as part of this transaction.
|
boolean |
hasStatementDependencies()
Returns whether statement dependencies are currently set.
|
void |
markStatementEnd()
Mark an exit from SQL statement execution within this transaction.
|
void |
markStatementStart(java.util.HashSet<MVMap<java.lang.Object,VersionedValue<java.lang.Object>>> maps)
Mark an entry into a new SQL statement execution within this transaction.
|
<K,V> TransactionMap<K,V> |
openMap(java.lang.String name)
Open a data map.
|
<K,V> TransactionMap<K,V> |
openMap(java.lang.String name,
DataType<K> keyType,
DataType<V> valueType)
Open the map to store the data.
|
<K,V> TransactionMap<K,V> |
openMapX(MVMap<K,VersionedValue<V>> map)
Open the transactional version of the given map.
|
void |
prepare()
Prepare the transaction.
|
<K,V> void |
removeMap(TransactionMap<K,V> map)
Remove the map.
|
void |
rollback()
Roll the transaction back.
|
void |
rollbackToSavepoint(long savepointId)
Roll back to the given savepoint.
|
void |
setName(java.lang.String name) |
long |
setSavepoint()
Create a new savepoint.
|
void |
setTimeoutMillis(int timeoutMillis)
Sets the new lock timeout.
|
java.lang.String |
toString() |
boolean |
waitFor(Transaction toWaitFor,
java.lang.String mapName,
java.lang.Object key)
Make this transaction to wait for the specified transaction to be closed,
because both of them try to modify the same map entry.
|
public static final int STATUS_CLOSED
public static final int STATUS_OPEN
public static final int STATUS_PREPARED
public static final int STATUS_COMMITTED
public int getId()
public long getSequenceNum()
public int getStatus()
public boolean hasChanges()
public void setName(java.lang.String name)
public java.lang.String getName()
public int getBlockerId()
public long setSavepoint()
public boolean hasStatementDependencies()
public IsolationLevel getIsolationLevel()
public boolean allowNonRepeatableRead()
public void markStatementStart(java.util.HashSet<MVMap<java.lang.Object,VersionedValue<java.lang.Object>>> maps)
maps - set of maps used by transaction or statement is about to be executedpublic void markStatementEnd()
public <K,V> TransactionMap<K,V> openMap(java.lang.String name)
K - the key typeV - the value typename - the name of the mappublic <K,V> TransactionMap<K,V> openMap(java.lang.String name, DataType<K> keyType, DataType<V> valueType)
K - the key typeV - the value typename - the name of the mapkeyType - the key data typevalueType - the value data typepublic <K,V> TransactionMap<K,V> openMapX(MVMap<K,VersionedValue<V>> map)
K - the key typeV - the value typemap - the base mappublic void prepare()
public void commit()
public void rollbackToSavepoint(long savepointId)
savepointId - the savepoint idpublic void rollback()
public java.util.Iterator<TransactionStore.Change> getChanges(long savepointId)
savepointId - the savepoint id, 0 meaning the beginning of the
transactionpublic void setTimeoutMillis(int timeoutMillis)
timeoutMillis - the new lock timeout in millisecondspublic boolean waitFor(Transaction toWaitFor, java.lang.String mapName, java.lang.Object key)
toWaitFor - transaction to wait formapName - name of the map containing blocking entrykey - of the blocking entrypublic <K,V> void removeMap(TransactionMap<K,V> map)
K - the key typeV - the value typemap - the mappublic java.lang.String toString()
toString in class java.lang.Object