Interface Transaction
- All Superinterfaces:
AutoCloseable, TransactionContext
An open transaction. Use try-with-resources: closing without
commit() aborts.
try (Transaction tx = engine.transactions().openOuter()) {
long moved = Transfers.move(source, target, filter, 1000, tx).moved();
if (moved == 1000) tx.commit();
}
Simulation is a transaction that is aborted, so simulating and executing share one code path.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TransactionContext
TransactionContext.CloseCallback, TransactionContext.Outcome -
Method Summary
Methods inherited from interface TransactionContext
addCloseCallback, nestingDepth, onCommit, openNested, parent
-
Method Details
-
commit
void commit()- Throws:
IllegalStateException- if already closed or a nested transaction is still open
-
abort
void abort()- Throws:
IllegalStateException- if already closed or a nested transaction is still open
-
isOpen
boolean isOpen() -
close
-