Created
August 29, 2011 22:55
-
-
Save sebersole/1179642 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void beforeCompletion() { | |
LOG.trace("Transaction before completion callback"); | |
boolean flush; | |
try { | |
final int status = transactionCoordinator | |
.getTransactionContext() | |
.getTransactionEnvironment() | |
.getJtaPlatform() | |
.getCurrentStatus(); | |
flush = managedFlushChecker.shouldDoManagedFlush( transactionCoordinator, status ); | |
} | |
catch ( SystemException se ) { | |
setRollbackOnly(); | |
throw exceptionMapper.mapStatusCheckFailure( "could not determine transaction status in beforeCompletion()", se ); | |
} | |
try { | |
if ( flush ) { | |
LOG.trace("Automatically flushing session"); | |
transactionCoordinator.getTransactionContext().managedFlush(); | |
} | |
} | |
catch ( RuntimeException re ) { | |
setRollbackOnly(); | |
throw exceptionMapper.mapManagedFlushFailure( "error during managed flush", re ); | |
} | |
finally { | |
try { | |
transactionCoordinator.sendBeforeTransactionCompletionNotifications( null ); | |
transactionCoordinator.getTransactionContext().beforeTransactionCompletion( null ); | |
} | |
catch ( RuntimeException re ) { | |
setRollbackOnly(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment