Package com.vaadin.signals.impl
Class StagedTransaction
java.lang.Object
com.vaadin.signals.impl.Transaction
com.vaadin.signals.impl.StagedTransaction
A conventional read-write transaction that stages commands to be submitted as
a single commit. Commits by incorporating staged changes into the outer
transaction if it's another staged transaction and otherwise performs a
two-phase commit to atomically apply changes to all participating trees.
Provides repeatable reads that are supplemented by changes from any staged
commands.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.signals.impl.Transaction
Transaction.Type -
Constructor Summary
ConstructorsConstructorDescriptionStagedTransaction(Transaction outer) Creates a new staged transaction for the given outer transaction. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcommit(Consumer<SignalOperation.ResultOrError<Void>> resultHandler) Commits any staged commands in this transaction.voidinclude(SignalTree tree, SignalCommand command, Consumer<CommandResult> resultHandler, boolean applyToTree) Includes the given command to the given tree in the context of this transaction and optionally also sets the command to be applied to the underlying signal tree.read(SignalTree tree) Gets a revision for reading from the given tree in the context of this transaction.protected voidrollback()Rolls back any staged commands in this transaction and notifies the result handlers for those commands.Methods inherited from class com.vaadin.signals.impl.Transaction
getCurrent, include, inTransaction, runInTransaction, runInTransaction, runInTransaction, runInTransaction, runWithoutTransaction, runWithoutTransaction
-
Constructor Details
-
StagedTransaction
Creates a new staged transaction for the given outer transaction.- Parameters:
outer- the outer transaction to wrap, notnull
-
-
Method Details
-
commit
Description copied from class:TransactionCommits any staged commands in this transaction.- Specified by:
commitin classTransaction- Parameters:
resultHandler- a consumer to update the result value in the corresponding transaction operation, notnull
-
include
public void include(SignalTree tree, SignalCommand command, Consumer<CommandResult> resultHandler, boolean applyToTree) Description copied from class:TransactionIncludes the given command to the given tree in the context of this transaction and optionally also sets the command to be applied to the underlying signal tree. Depending on the transaction type, an applied command may be applied immediately, collected to be applied upon committing, or rejected with anIllegalStateException.- Specified by:
includein classTransaction- Parameters:
tree- the signal tree against which to run the command, notnullcommand- the command to include, notnullresultHandler- the handler of the command result, ornullto ignore the resultapplyToTree-trueto apply the command to the underlying tree,falseto only update the transaction's repeatable-read revision
-
read
Description copied from class:TransactionGets a revision for reading from the given tree in the context of this transaction.- Specified by:
readin classTransaction- Parameters:
tree- the tree to read from, notnull- Returns:
- a tree revision to read from, not
null
-
rollback
protected void rollback()Description copied from class:TransactionRolls back any staged commands in this transaction and notifies the result handlers for those commands.- Specified by:
rollbackin classTransaction
-