Package io.permazen.spring
Class PermazenTransactionManager.TransactionSynchronizationCallback
java.lang.Object
io.permazen.spring.PermazenTransactionManager.TransactionSynchronizationCallback
- All Implemented Interfaces:
Transaction.Callback
- Enclosing class:
- PermazenTransactionManager
public static class PermazenTransactionManager.TransactionSynchronizationCallback
extends Object
implements Transaction.Callback
Adapter class that wraps a Spring
TransactionSynchronization
in the
Transaction.Callback
interface.-
Field Summary
-
Constructor Summary
ConstructorDescriptionTransactionSynchronizationCallback
(TransactionSynchronization synchronization) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked after successful transaction commit (and beforeafterCompletion()
).void
afterCompletion
(boolean committed) Invoked after transaction completion (but after anyTransaction.Callback.afterCommit()
).void
beforeCommit
(boolean readOnly) Invoked before transaction commit (and beforeTransaction.Callback.beforeCompletion()
).void
Invoked before transaction completion in any case (but after anybeforeCommit()
).boolean
int
hashCode()
-
Field Details
-
synchronization
-
-
Constructor Details
-
TransactionSynchronizationCallback
Constructor.- Parameters:
synchronization
- transaction callback- Throws:
IllegalArgumentException
- ifsynchronization
is null
-
-
Method Details
-
beforeCommit
public void beforeCommit(boolean readOnly) Description copied from interface:Transaction.Callback
Invoked before transaction commit (and beforeTransaction.Callback.beforeCompletion()
). This method is invoked when a transaction is intended to be committed; it may however still be rolled back.Any exceptions thrown will result in a transaction rollback and be propagated to the caller.
- Specified by:
beforeCommit
in interfaceTransaction.Callback
- Parameters:
readOnly
- true if the transaction is marked read-only
-
beforeCompletion
public void beforeCompletion()Description copied from interface:Transaction.Callback
Invoked before transaction completion in any case (but after anybeforeCommit()
). This method is invoked whether the transaction is going to be committed or rolled back, and is invoked even ifbeforeCommit()
throws an exception. Typically used to clean up resources before transaction completion.Any exceptions thrown will be logged but will not propagate to the caller.
- Specified by:
beforeCompletion
in interfaceTransaction.Callback
-
afterCommit
public void afterCommit()Description copied from interface:Transaction.Callback
Invoked after successful transaction commit (and beforeafterCompletion()
).Any exceptions thrown will propagate to the caller.
- Specified by:
afterCommit
in interfaceTransaction.Callback
-
afterCompletion
public void afterCompletion(boolean committed) Description copied from interface:Transaction.Callback
Invoked after transaction completion (but after anyTransaction.Callback.afterCommit()
). This method is invoked in any case, whether the transaction was committed or rolled back. Typically used to clean up resources after transaction completion.Any exceptions thrown will be logged but will not propagate to the caller.
- Specified by:
afterCompletion
in interfaceTransaction.Callback
- Parameters:
committed
- true if transaction was commited, false if transaction was rolled back
-
equals
-
hashCode
public int hashCode()
-