|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for transaction synchronization callbacks. Supported by AbstractPlatformTransactionManager.
TransactionSynchronization implementations can implement the Ordered interface to influence their execution order. A synchronization that does not implement the Ordered interface is appended to the end of the synchronization chain.
System synchronizations performed by Spring itself use specific order values, allowing for fine-grained interaction with their execution order (if necessary).
TransactionSynchronizationManager
,
AbstractPlatformTransactionManager
,
DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER
,
SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER
Field Summary | |
static int |
STATUS_COMMITTED
Completion status in case of proper commit |
static int |
STATUS_ROLLED_BACK
Completion status in case of proper rollback |
static int |
STATUS_UNKNOWN
Completion status in case of heuristic mixed completion or system errors |
Method Summary | |
void |
afterCompletion(int status)
Invoked after transaction commit/rollback. |
void |
beforeCommit(boolean readOnly)
Invoked before transaction commit (before "beforeCompletion"). |
void |
beforeCompletion()
Invoked before transaction commit/rollback (after "beforeCommit", even if beforeCommit threw an exception). |
void |
resume()
Resume this synchronization. |
void |
suspend()
Suspend this synchronization. |
Field Detail |
public static final int STATUS_COMMITTED
public static final int STATUS_ROLLED_BACK
public static final int STATUS_UNKNOWN
Method Detail |
public void suspend()
TransactionSynchronizationManager.unbindResource(java.lang.Object)
public void resume()
TransactionSynchronizationManager.bindResource(java.lang.Object, java.lang.Object)
public void beforeCommit(boolean readOnly)
Note that exceptions will get propagated to the commit caller and cause a rollback of the transaction.
readOnly
- if the transaction is defined as read-only transaction
RuntimeException
- in case of errors
(note: do not throw TransactionException subclasses here!)beforeCompletion()
public void beforeCompletion()
Note that exceptions will get propagated to the commit caller and cause a rollback of the transaction.
RuntimeException
- in case of errors
(note: do not throw TransactionException subclasses here!)beforeCommit(boolean)
,
afterCompletion(int)
public void afterCompletion(int status)
Note that exceptions will get propagated to the commit or rollback caller, although they will not influence the outcome of the transaction.
status
- completion status according to the STATUS_* constants
RuntimeException
- in case of errors
(note: do not throw TransactionException subclasses here!)STATUS_COMMITTED
,
STATUS_ROLLED_BACK
,
STATUS_UNKNOWN
,
beforeCompletion()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |