|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.TransactionSynchronizationAdapter org.springframework.jdbc.support.lob.SpringLobCreatorSynchronization
public class SpringLobCreatorSynchronization
Callback for resource cleanup at the end of a Spring transaction.
Invokes LobCreator.close()
to clean up temporary LOBs
that might have been created.
LobCreator.close()
Field Summary | |
---|---|
static int |
LOB_CREATOR_SYNCHRONIZATION_ORDER
Order value for TransactionSynchronization objects that clean up LobCreators. |
Fields inherited from interface org.springframework.transaction.support.TransactionSynchronization |
---|
STATUS_COMMITTED, STATUS_ROLLED_BACK, STATUS_UNKNOWN |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
SpringLobCreatorSynchronization(LobCreator lobCreator)
Create a SpringLobCreatorSynchronization for the given LobCreator. |
Method Summary | |
---|---|
void |
afterCompletion(int status)
Invoked after transaction commit/rollback. |
void |
beforeCompletion()
Invoked before transaction commit/rollback. |
int |
getOrder()
Return the order value of this object, with a higher value meaning greater in terms of sorting. |
Methods inherited from class org.springframework.transaction.support.TransactionSynchronizationAdapter |
---|
afterCommit, beforeCommit, resume, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER
Constructor Detail |
---|
public SpringLobCreatorSynchronization(LobCreator lobCreator)
lobCreator
- the LobCreator to close after transaction completionMethod Detail |
---|
public int getOrder()
Ordered
Normally starting with 0 or 1, with Ordered.LOWEST_PRECEDENCE
indicating greatest. Same order values will result in arbitrary
positions for the affected objects.
Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).
Note that order values below 0 are reserved for framework purposes. Application-specified values should always be 0 or greater, with only framework components (internal or third-party) supposed to use lower values.
getOrder
in interface Ordered
getOrder
in class TransactionSynchronizationAdapter
Ordered.LOWEST_PRECEDENCE
public void beforeCompletion()
TransactionSynchronization
This method will be invoked after beforeCommit
, even when
beforeCommit
threw an exception. This callback allows for
closing resources before transaction completion, for any outcome.
beforeCompletion
in interface TransactionSynchronization
beforeCompletion
in class TransactionSynchronizationAdapter
public void afterCompletion(int status)
TransactionSynchronization
NOTE: The transaction will have been committed or rolled back already,
but the transactional resources might still be active and accessible. As a
consequence, any data access code triggered at this point will still "participate"
in the original transaction, allowing to perform some cleanup (with no commit
following anymore!), unless it explicitly declares that it needs to run in a
separate transaction. Hence: Use PROPAGATION_REQUIRES_NEW
for any transactional operation that is called from here.
afterCompletion
in interface TransactionSynchronization
afterCompletion
in class TransactionSynchronizationAdapter
status
- completion status according to the STATUS_*
constantsTransactionSynchronization.STATUS_COMMITTED
,
TransactionSynchronization.STATUS_ROLLED_BACK
,
TransactionSynchronization.STATUS_UNKNOWN
,
TransactionSynchronization.beforeCompletion()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |