HHH-9312 - Database connection leak with JTA transaction tracking and background thread not releasing database connection

This commit is contained in:
Steve Ebersole 2014-08-04 13:32:51 -05:00
parent 88a93f8c03
commit 9e1afbaf49
2 changed files with 8 additions and 0 deletions

View File

@ -62,6 +62,10 @@ public class SynchronizationCallbackCoordinatorNonTrackingImpl implements Synchr
afterCompletionAction = STANDARD_AFTER_COMPLETION_ACTION;
}
protected final TransactionCoordinator transactionCoordinator() {
return transactionCoordinator;
}
private TransactionContext transactionContext() {
return transactionCoordinator.getTransactionContext();
}

View File

@ -79,6 +79,10 @@ public class SynchronizationCallbackCoordinatorTrackingImpl extends Synchronizat
// check for it in SessionImpl. See HHH-7910.
delayedCompletionHandlingStatus = status;
// no matter what we need to release the Connection. Not releasing
// the Connection here can lead to leaked Connections.
transactionCoordinator().getJdbcCoordinator().getLogicalConnection().close();
log.rollbackFromBackgroundThread( status );
return;
}