Package com.hazelcast.transaction
Interface TransactionContext
- All Superinterfaces:
TransactionalTaskContext
Provides a context to perform transactional operations: beginning/committing transactions, but also retrieving
transactional data-structures like the
TransactionalMap
.
Any method accessed through TransactionContext interface can throw TransactionException if transaction is
no longer valid and rolled back.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Begins a transaction.void
Commits a transaction.getTxnId()
Gets the ID that uniquely identifies the transaction.void
Rollback of the current transaction.Methods inherited from interface com.hazelcast.transaction.TransactionalTaskContext
getList, getMap, getMultiMap, getQueue, getSet, getTransactionalObject
-
Method Details
-
beginTransaction
void beginTransaction()Begins a transaction.- Throws:
IllegalStateException
- if a transaction already is active.
-
commitTransaction
Commits a transaction.- Throws:
TransactionException
- if no transaction is active or the transaction could not be committed.
-
rollbackTransaction
void rollbackTransaction()Rollback of the current transaction.- Throws:
IllegalStateException
- if there is no active transaction.
-
getTxnId
UUID getTxnId()Gets the ID that uniquely identifies the transaction.- Returns:
- the transaction ID
-