public class SpringLobCreatorSynchronization extends TransactionSynchronizationAdapter
LobCreator.close()
to clean up temporary LOBs
that might have been created.LobCreator.close()
Modifier and Type | Field and Description |
---|---|
static int |
LOB_CREATOR_SYNCHRONIZATION_ORDER
Order value for TransactionSynchronization objects that clean up LobCreators.
|
STATUS_COMMITTED, STATUS_ROLLED_BACK, STATUS_UNKNOWN
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
SpringLobCreatorSynchronization(LobCreator lobCreator)
Create a SpringLobCreatorSynchronization for the given LobCreator.
|
Modifier and Type | Method and Description |
---|---|
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.
|
afterCommit, beforeCommit, flush, resume, suspend
public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER
public SpringLobCreatorSynchronization(LobCreator lobCreator)
lobCreator
- the LobCreator to close after transaction completionpublic int getOrder()
Ordered
Normally starting with 0, with Integer.MAX_VALUE
indicating the greatest value. Same order values will result
in arbitrary positions for the affected objects.
Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).
getOrder
in interface Ordered
getOrder
in class TransactionSynchronizationAdapter
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
TransactionSynchronization.beforeCommit(boolean)
,
TransactionSynchronization.afterCompletion(int)
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()