联系
Knight's Tale » 技术

Spring transaction synchronization

2015-07-02 15:19

http://docs.oracle.com/javaee/5/api/javax/transaction/Synchronization.html

The transaction manager supports a synchronization mechanism that allows the interested party to be notified before and after the transaction completes. Using the registerSynchronization method, the application server registers a Synchronization object for the transaction currently associated with the target Transaction object.

spring的事务允许用户程序绑定到事务线程中,这样就可以达到在 事务提交前、提交后 执行用户代码。

可以通过 isSynchronizationActive 来判断 当前是否能进行绑定

通过 registerSynchronization 来进行绑定互此事务中。