public class VoidTransaction extends Object
FunctionalTransaction| Constructor and Description |
|---|
VoidTransaction(RunnableWithException operation)
Constructs a lightweight transaction that can have a rollback and a commit.
|
| Modifier and Type | Method and Description |
|---|---|
VoidTransaction |
retry(int times)
Specify the number of retires for this transaction.
|
VoidTransaction |
withCommit(Runnable commit)
Specify the commit for this transaction.
|
VoidTransaction |
withReset(Runnable rollback)
Alias for
withRollback(Runnable) |
VoidTransaction |
withRollback(Runnable rollback)
Specify the rollback for this transaction.
|
VoidTransaction |
withVerification(java.util.function.Supplier<Boolean> verification)
Specify the verification
Supplier for this transaction. |
public VoidTransaction(RunnableWithException operation)
operation - the operation to perform.public VoidTransaction withReset(Runnable rollback)
withRollback(Runnable)rollback - the Runnable to perform in order to rollback any changes from the transactionpublic VoidTransaction withRollback(Runnable rollback)
rollback - the Runnable to perform in order to rollback any changes from the operationpublic VoidTransaction withCommit(Runnable commit)
commit - the Runnable to perform in order to commit any changes from the operationpublic VoidTransaction withVerification(java.util.function.Supplier<Boolean> verification)
Supplier for this transaction.
The verification Supplier will be run to assess whether an attempt
has been successful. If the operation threw an Exception, verification is not necessary.verification - - a Supplier that returns false if there has been an errorpublic VoidTransaction retry(int times)
times - the number of times this operation should be retried before giving upCopyright © 2019. All rights reserved.