Package org.springframework.transaction
Interface TransactionExecutionListener
public interface TransactionExecutionListener
Callback interface for stateless listening to transaction creation/completion steps
in a transaction manager. This is primarily meant for observation and statistics;
consider stateful transaction synchronizations for resource management purposes.
In contrast to synchronizations, the transaction execution listener contract is
commonly supported for thread-bound transactions as well as reactive transactions.
The callback-provided TransactionExecution
object will be either a
TransactionStatus
(for a PlatformTransactionManager
transaction) or
a ReactiveTransaction
(for a ReactiveTransactionManager
transaction).
- Since:
- 6.1
- Author:
- Juergen Hoeller
- See Also:
-
ConfigurableTransactionManager.addListener(org.springframework.transaction.TransactionExecutionListener)
TransactionSynchronizationManager.registerSynchronization(org.springframework.transaction.support.TransactionSynchronization)
TransactionSynchronizationManager.registerSynchronization(org.springframework.transaction.reactive.TransactionSynchronization)
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterBegin
(TransactionExecution transaction, Throwable beginFailure) Callback after the transaction begin step.default void
afterCommit
(TransactionExecution transaction, Throwable commitFailure) Callback after the transaction commit step.default void
afterRollback
(TransactionExecution transaction, Throwable rollbackFailure) Callback after the transaction rollback step.default void
beforeBegin
(TransactionExecution transaction) Callback before the transaction begin step.default void
beforeCommit
(TransactionExecution transaction) Callback before the transaction commit step.default void
beforeRollback
(TransactionExecution transaction) Callback before the transaction rollback step.
-
Method Details
-
beforeBegin
Callback before the transaction begin step.- Parameters:
transaction
- the current transaction
-
afterBegin
Callback after the transaction begin step.- Parameters:
transaction
- the current transactionbeginFailure
- an exception occurring during begin (ornull
after a successful begin step)
-
beforeCommit
Callback before the transaction commit step.- Parameters:
transaction
- the current transaction
-
afterCommit
Callback after the transaction commit step.- Parameters:
transaction
- the current transactioncommitFailure
- an exception occurring during commit (ornull
after a successful commit step)
-
beforeRollback
Callback before the transaction rollback step.- Parameters:
transaction
- the current transaction
-
afterRollback
Callback after the transaction rollback step.- Parameters:
transaction
- the current transactionrollbackFailure
- an exception occurring during rollback (ornull
after a successful rollback step)
-