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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinvokeAfterCommit(@Nullable List<TransactionSynchronization> synchronizations) Actually invoke theafterCommitmethods of the given Spring TransactionSynchronization objects.static voidinvokeAfterCompletion(@Nullable List<TransactionSynchronization> synchronizations, int completionStatus) Actually invoke theafterCompletionmethods of the given Spring TransactionSynchronization objects.static booleansameResourceFactory(ResourceTransactionManager tm, Object resourceFactory) Check whether the given resource transaction manager refers to the given (underlying) resource factory.static voidTriggerafterCommitcallbacks on all currently registered synchronizations.static voidtriggerAfterCompletion(int completionStatus) TriggerafterCompletioncallbacks on all currently registered synchronizations.static voidtriggerBeforeCommit(boolean readOnly) TriggerbeforeCommitcallbacks on all currently registered synchronizations.static voidTriggerbeforeCompletioncallbacks on all currently registered synchronizations.static voidTriggerflushcallbacks on all currently registered synchronizations.static ObjectunwrapResourceIfNecessary(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.- See Also:
-
unwrapResourceIfNecessary
-
triggerFlush
public static void triggerFlush()Triggerflushcallbacks on all currently registered synchronizations.- Throws:
RuntimeException- if thrown by aflushcallback- See Also:
-
triggerBeforeCommit
public static void triggerBeforeCommit(boolean readOnly) TriggerbeforeCommitcallbacks on all currently registered synchronizations.- Parameters:
readOnly- whether the transaction is defined as read-only transaction- Throws:
RuntimeException- if thrown by abeforeCommitcallback- See Also:
-
triggerBeforeCompletion
public static void triggerBeforeCompletion()TriggerbeforeCompletioncallbacks on all currently registered synchronizations.- See Also:
-
triggerAfterCommit
public static void triggerAfterCommit()TriggerafterCommitcallbacks on all currently registered synchronizations.- Throws:
RuntimeException- if thrown by aafterCommitcallback- See Also:
-
invokeAfterCommit
Actually invoke theafterCommitmethods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations- a List of TransactionSynchronization objects- See Also:
-
triggerAfterCompletion
public static void triggerAfterCompletion(int completionStatus) TriggerafterCompletioncallbacks 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 theafterCompletionmethods 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:
-