mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-9312 - Database connection leak with JTA transaction tracking and background thread not releasing database connection
(cherry picked from commit 9e1afbaf49dacb3e345666ca1f27b1a6e74d3de2)
This commit is contained in:
parent
a0663f0d6c
commit
72e9645d4b
@ -63,6 +63,10 @@ public void reset() {
|
||||
afterCompletionAction = STANDARD_AFTER_COMPLETION_ACTION;
|
||||
}
|
||||
|
||||
protected final TransactionCoordinator transactionCoordinator() {
|
||||
return transactionCoordinator;
|
||||
}
|
||||
|
||||
private TransactionContext transactionContext() {
|
||||
return transactionCoordinator.getTransactionContext();
|
||||
}
|
||||
|
@ -78,6 +78,10 @@ public void afterCompletion(int status) {
|
||||
// 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…
x
Reference in New Issue
Block a user