@FunctionalInterface public interface TransactionalCallable<T>
FunctionalInterface
that wraps transactional code.
Transactional code should not depend on any captured scope, but use the
argument Configuration
passed to the run(Configuration)
method to derive its transaction context.
If transactional code needs to depend on captured scope ("context"), then
ContextTransactionalCallable
is a better fit.
Modifier and Type | Method and Description |
---|---|
T |
run(Configuration configuration)
Run the transactional code.
|
T run(Configuration configuration) throws Throwable
If this method completes normally, and this is not a nested transaction,
then the transaction will be committed. If this method completes with an
exception (any Throwable
), then the transaction is rolled back to
the beginning of this TransactionalCallable
.
configuration
- The Configuration
in whose context the
transaction is run.Throwable
- Any exception that will cause a rollback of the code
contained in this transaction. If this is a nested
transaction, the rollback may be performed only to the state
before executing this TransactionalCallable
.Copyright © 2019. All rights reserved.