HHH-9312 - Database connection leak with JTA transaction tracking and background thread not releasing database connection
(cherry picked from commit 9e1afbaf49
)
This commit is contained in:
parent
a0663f0d6c
commit
72e9645d4b
|
@ -63,6 +63,10 @@ public class SynchronizationCallbackCoordinatorNonTrackingImpl implements Synchr
|
|||
afterCompletionAction = STANDARD_AFTER_COMPLETION_ACTION;
|
||||
}
|
||||
|
||||
protected final TransactionCoordinator transactionCoordinator() {
|
||||
return transactionCoordinator;
|
||||
}
|
||||
|
||||
private TransactionContext transactionContext() {
|
||||
return transactionCoordinator.getTransactionContext();
|
||||
}
|
||||
|
|
|
@ -78,6 +78,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue