Class TransactionSynchronizationUtils
- java.lang.Object
- org.springframework.transaction.support.TransactionSynchronizationUtils
public abstract class TransactionSynchronizationUtils extends Object
Utility methods for triggering specificTransactionSynchronization
callback methods on all currently registered synchronizations.- Since:
- 2.0
- Author:
- Juergen Hoeller
- 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(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 managers refers to the given (underlying) resource factory.static void
triggerAfterCommit()
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()
TriggerbeforeCompletion
callbacks on all currently registered synchronizations.static void
triggerFlush()
Triggerflush
callbacks on all currently registered synchronizations.
Constructor Detail
TransactionSynchronizationUtils
public TransactionSynchronizationUtils()
Method Detail
sameResourceFactory
public static boolean sameResourceFactory(ResourceTransactionManager tm, Object resourceFactory)
Check whether the given resource transaction managers refers to the given (underlying) resource factory.
triggerFlush
public static void triggerFlush()
Triggerflush
callbacks on all currently registered synchronizations.- Throws:
RuntimeException
- if thrown by aflush
callback- See Also:
TransactionSynchronization.flush()
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:
TransactionSynchronization.beforeCommit(boolean)
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:
TransactionSynchronizationManager.getSynchronizations()
,TransactionSynchronization.afterCommit()
invokeAfterCommit
public static void invokeAfterCommit(List<TransactionSynchronization> synchronizations)
Actually invoke theafterCommit
methods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations
- List of TransactionSynchronization objects- See Also:
TransactionSynchronization.afterCommit()
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:
TransactionSynchronizationManager.getSynchronizations()
,TransactionSynchronization.afterCompletion(int)
,TransactionSynchronization.STATUS_COMMITTED
,TransactionSynchronization.STATUS_ROLLED_BACK
,TransactionSynchronization.STATUS_UNKNOWN
invokeAfterCompletion
public static void invokeAfterCompletion(List<TransactionSynchronization> synchronizations, int completionStatus)
Actually invoke theafterCompletion
methods of the given Spring TransactionSynchronization objects.- Parameters:
synchronizations
- List of TransactionSynchronization objectscompletionStatus
- the completion status according to the constants in the TransactionSynchronization interface- See Also:
TransactionSynchronization.afterCompletion(int)
,TransactionSynchronization.STATUS_COMMITTED
,TransactionSynchronization.STATUS_ROLLED_BACK
,TransactionSynchronization.STATUS_UNKNOWN