org.springframework.transaction.support
Interface TransactionSynchronization

All Known Implementing Classes:
TransactionSynchronizationAdapter

public interface TransactionSynchronization

Interface for callbacks after transaction completion. Supported by AbstractPlatformTransactionManager.

Since:
02.06.2003
Author:
Juergen Hoeller
See Also:
TransactionSynchronizationManager, AbstractPlatformTransactionManager

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
          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").
 void resume()
          Resume this synchronization.
 void suspend()
          Suspend this synchronization.
 

Field Detail

STATUS_COMMITTED

public static final int STATUS_COMMITTED
Completion status in case of proper commit

See Also:
Constant Field Values

STATUS_ROLLED_BACK

public static final int STATUS_ROLLED_BACK
Completion status in case of proper rollback

See Also:
Constant Field Values

STATUS_UNKNOWN

public static final int STATUS_UNKNOWN
Status in case of heuristic mixed completion or system errors

See Also:
Constant Field Values
Method Detail

suspend

public void suspend()
Suspend this synchronization. Supposed to unbind resources from TransactionSynchronizationManager if managing any.


resume

public void resume()
Resume this synchronization. Supposed to rebind resources to TransactionSynchronizationManager if managing any.


beforeCommit

public void beforeCommit(boolean readOnly)
Invoked before transaction commit (before "beforeCompletion"). Can e.g. flush transactional sessions to the database.

Note that exceptions will get propagated to the commit caller and cause a rollback of the transaction.

Parameters:
readOnly - if the transaction is defined as read-only transaction
Throws:
java.lang.RuntimeException - in case of errors

beforeCompletion

public void beforeCompletion()
Invoked before transaction commit/rollback (after "beforeCommit"). Can e.g. perform proper resource cleanup.

Note that exceptions will get propagated to the commit caller and cause a rollback of the transaction.

Throws:
java.lang.RuntimeException - in case of errors

afterCompletion

public void afterCompletion(int status)
Invoked after transaction commit/rollback. Can e.g. perform proper resource cleanup.

Note that exceptions will get propagated to the commit or rollback caller, although they will not influence the outcome of the transaction.

Parameters:
status - completion status according to the STATUS_ constants
Throws:
java.lang.RuntimeException - in case of errors
See Also:
STATUS_COMMITTED, STATUS_ROLLED_BACK, STATUS_UNKNOWN


Copyright (C) 2003-2004 The Spring Framework Project.