Interface TransactionContext
- All Known Subinterfaces:
Transaction
@NonExtendable
public interface TransactionContext
The transaction an operation runs in (ARCHITECTURE.md §10.2, D11). Operations take a context
rather than a
Transaction so they cannot commit or abort it themselves.
A transaction and everything done inside it belongs to the thread that opened it.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic enum -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseCallback(@NotNull TransactionContext.CloseCallback callback) Called when this transaction closes, in reverse registration order.int0 for the outer transaction, 1 for its first nested transaction, …voidRunsactiononce the outer transaction has committed, if every transaction between this one and the outer one committed too.@NotNull TransactionOpens a transaction nested in this one.@Nullable TransactionContextparent()
-
Method Details
-
nestingDepth
int nestingDepth()0 for the outer transaction, 1 for its first nested transaction, … -
parent
- Returns:
- the enclosing transaction, or
nullfor the outer one
-
openNested
Opens a transaction nested in this one. Its changes are undone if it aborts, and become part of this transaction if it commits.- Throws:
IllegalStateException- if this is not the innermost open transaction
-
addCloseCallback
Called when this transaction closes, in reverse registration order. -
onCommit
Runsactiononce the outer transaction has committed, if every transaction between this one and the outer one committed too. Dropped on any abort. Use it for side effects such as wake-ups, events and dirty marking.
-