Package io.micronaut.transaction.support
Class TransactionSynchronizationUtils
- java.lang.Object
-
- io.micronaut.transaction.support.TransactionSynchronizationUtils
-
@Internal public abstract class TransactionSynchronizationUtils extends java.lang.Object
Utility methods for triggering specificTransactionSynchronization
callback methods on all currently registered synchronizations.- Since:
- 1.0
- Author:
- Juergen Hoeller, graemerocher
- See Also:
TransactionSynchronization
,TransactionSynchronizationManager.getSynchronizations()
-
-
Constructor Summary
Constructors Constructor Description TransactionSynchronizationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
invokeAfterCommit(java.util.List<TransactionSynchronization> synchronizations)
Actually invoke theafterCommit
methods of the given Spring TransactionSynchronization objects.static void
invokeAfterCompletion(java.util.List<TransactionSynchronization> synchronizations, TransactionSynchronization.Status completionStatus)
Actually invoke theafterCompletion
methods of the given Spring TransactionSynchronization objects.static boolean
sameResourceFactory(ResourceTransactionManager tm, java.lang.Object resourceFactory)
Check whether the given resource transaction managers refers to the given (underlying) resource factory.static void
triggerAfterCommit(SynchronousTransactionState state)
TriggerafterCommit
callbacks on all currently registered synchronizations.static void
triggerAfterCompletion(SynchronousTransactionState state, TransactionSynchronization.Status completionStatus)
TriggerafterCompletion
callbacks on all currently registered synchronizations.static void
triggerBeforeCommit(SynchronousTransactionState state, boolean readOnly)
TriggerbeforeCommit
callbacks on all currently registered synchronizations.static void
triggerBeforeCompletion(SynchronousTransactionState state)
TriggerbeforeCompletion
callbacks on all currently registered synchronizations.static void
triggerFlush(SynchronousTransactionState state)
Triggerflush
callbacks on all currently registered synchronizations.
-
-
-
Method Detail
-
sameResourceFactory
public static boolean sameResourceFactory(ResourceTransactionManager tm, java.lang.Object resourceFactory)
Check whether the given resource transaction managers refers to the given (underlying) resource factory.- Parameters:
tm
- the resource managerresourceFactory
- The resource factory- Returns:
- True if the factories are the same
- See Also:
ResourceTransactionManager.getResourceFactory()
-
triggerFlush
public static void triggerFlush(SynchronousTransactionState state)
Triggerflush
callbacks on all currently registered synchronizations.- Parameters:
state
- The transaction state- Throws:
java.lang.RuntimeException
- if thrown by aflush
callback- See Also:
TransactionSynchronization.flush()
-
triggerBeforeCommit
public static void triggerBeforeCommit(SynchronousTransactionState state, boolean readOnly)
TriggerbeforeCommit
callbacks on all currently registered synchronizations.- Parameters:
state
- The transaction statereadOnly
- whether the transaction is defined as read-only transaction- Throws:
java.lang.RuntimeException
- if thrown by abeforeCommit
callback- See Also:
TransactionSynchronization.beforeCommit(boolean)
-
triggerBeforeCompletion
public static void triggerBeforeCompletion(SynchronousTransactionState state)
TriggerbeforeCompletion
callbacks on all currently registered synchronizations.- Parameters:
state
- The transaction state- See Also:
TransactionSynchronization.beforeCompletion()
-
triggerAfterCommit
public static void triggerAfterCommit(SynchronousTransactionState state)
TriggerafterCommit
callbacks on all currently registered synchronizations.- Parameters:
state
- The transaction state- Throws:
java.lang.RuntimeException
- if thrown by aafterCommit
callback- See Also:
SynchronousTransactionState.getSynchronizations()
,TransactionSynchronization.afterCommit()
-
invokeAfterCommit
public static void invokeAfterCommit(@Nullable java.util.List<TransactionSynchronization> synchronizations)
Actually invoke theafterCommit
methods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations
- a List of TransactionSynchronization objects- See Also:
TransactionSynchronization.afterCommit()
-
triggerAfterCompletion
public static void triggerAfterCompletion(SynchronousTransactionState state, @NonNull TransactionSynchronization.Status completionStatus)
TriggerafterCompletion
callbacks on all currently registered synchronizations.- Parameters:
state
- The transaction statecompletionStatus
- the completion status according to the constants in the TransactionSynchronization interface- See Also:
SynchronousTransactionState.getSynchronizations()
,TransactionSynchronization.afterCompletion(TransactionSynchronization.Status)
,TransactionSynchronization.Status.COMMITTED
,TransactionSynchronization.Status.ROLLED_BACK
,TransactionSynchronization.Status.UNKNOWN
-
invokeAfterCompletion
public static void invokeAfterCompletion(@Nullable java.util.List<TransactionSynchronization> synchronizations, @NonNull TransactionSynchronization.Status completionStatus)
Actually invoke theafterCompletion
methods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations
- a List of TransactionSynchronization objectscompletionStatus
- the completion status according to the constants in the TransactionSynchronization interface- See Also:
TransactionSynchronization.afterCompletion(TransactionSynchronization.Status)
,TransactionSynchronization.Status.COMMITTED
,TransactionSynchronization.Status.ROLLED_BACK
,TransactionSynchronization.Status.UNKNOWN
-
-