Class TransactionSynchronizationUtils
java.lang.Object
org.springframework.transaction.support.TransactionSynchronizationUtils
Utility methods for triggering specific
TransactionSynchronization
callback methods on all currently registered synchronizations.- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
invokeAfterCommit
(List<TransactionSynchronization> synchronizations) Actually invoke theafterCommit
methods of the given Spring TransactionSynchronization objects.static void
invokeAfterCompletion
(List<TransactionSynchronization> synchronizations, int completionStatus) Actually invoke theafterCompletion
methods of the given Spring TransactionSynchronization objects.static boolean
sameResourceFactory
(ResourceTransactionManager tm, Object resourceFactory) Check whether the given resource transaction manager refers to the given (underlying) resource factory.static void
TriggerafterCommit
callbacks on all currently registered synchronizations.static void
triggerAfterCompletion
(int completionStatus) TriggerafterCompletion
callbacks on all currently registered synchronizations.static void
triggerBeforeCommit
(boolean readOnly) TriggerbeforeCommit
callbacks on all currently registered synchronizations.static void
TriggerbeforeCompletion
callbacks on all currently registered synchronizations.static void
Triggerflush
callbacks on all currently registered synchronizations.static Object
unwrapResourceIfNecessary
(Object resource) Unwrap the given resource handle if necessary; otherwise return the given handle as-is.
-
Constructor Details
-
TransactionSynchronizationUtils
public TransactionSynchronizationUtils()
-
-
Method Details
-
sameResourceFactory
Check whether the given resource transaction manager refers to the given (underlying) resource factory. -
unwrapResourceIfNecessary
Unwrap the given resource handle if necessary; otherwise return the given handle as-is.- Since:
- 5.3.4
- See Also:
-
triggerFlush
public static void triggerFlush()Triggerflush
callbacks on all currently registered synchronizations.- Throws:
RuntimeException
- if thrown by aflush
callback- See Also:
-
triggerBeforeCommit
public static void triggerBeforeCommit(boolean readOnly) TriggerbeforeCommit
callbacks on all currently registered synchronizations.- Parameters:
readOnly
- whether the transaction is defined as read-only transaction- Throws:
RuntimeException
- if thrown by abeforeCommit
callback- See Also:
-
triggerBeforeCompletion
public static void triggerBeforeCompletion()TriggerbeforeCompletion
callbacks on all currently registered synchronizations. -
triggerAfterCommit
public static void triggerAfterCommit()TriggerafterCommit
callbacks on all currently registered synchronizations.- Throws:
RuntimeException
- if thrown by aafterCommit
callback- See Also:
-
invokeAfterCommit
Actually invoke theafterCommit
methods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations
- a List of TransactionSynchronization objects- See Also:
-
triggerAfterCompletion
public static void triggerAfterCompletion(int completionStatus) TriggerafterCompletion
callbacks on all currently registered synchronizations.- Parameters:
completionStatus
- the completion status according to the constants in the TransactionSynchronization interface- See Also:
-
invokeAfterCompletion
public static void invokeAfterCompletion(@Nullable List<TransactionSynchronization> synchronizations, int 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:
-