Interface TransactionAware
public interface TransactionAware
Transaction callback object that can be registered on
Transaction
s.
Interface for transaction-aware objects. The following state diagram shows the states of a transaction and the actions taken on the different states (method calls on all registered TransactionAware objects):
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
cleanup()
Cleanup.default void
commit()
Actually commit the transaction after a successfulpreparation
.default void
panic()
Try to prevent the end of the universe.default void
Prepare committing a transaction.default void
Rollback the transaction after thepreparation
failed.default void
rollback()
Rollback the transaction.
-
Method Details
-
prepareCommit
Prepare committing a transaction. Any actions that may well go wrong should be taken here. During this phase, anything may go wrong, therefore, any exception may be thrown during prepare.- Throws:
Exception
-
commit
default void commit()Actually commit the transaction after a successfulpreparation
. This should succeed, if any exception is thrown, the transaction will panic. -
rollback
default void rollback()Rollback the transaction. This should succeed, if any exception is thrown, the transaction will panic. -
prepareFailed
default void prepareFailed()Rollback the transaction after thepreparation
failed. This should succeed, if any exception is thrown, the transaction will panic. -
panic
default void panic()Try to prevent the end of the universe. -
cleanup
default void cleanup()Cleanup. Whatever happened, this method will always be called last. -
getContext
Context getContext()
-