Skip to content

Commit ebb525e

Browse files
committed
Fix connection leaks in hibernate-testing connection provider delegates
1 parent f6a296b commit ebb525e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ protected void closeConnection(Connection conn, Throwable t) {
472472
}
473473
}
474474
finally {
475-
allConnections.remove( conn );
475+
if ( !allConnections.remove( conn ) ) {
476+
ConnectionInfoLogger.INSTANCE.debug( "Connection remove failed." );
477+
}
476478
}
477479
}
478480

hibernate-testing/src/main/java/org/hibernate/testing/jta/JtaAwareConnectionProviderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private void delist(Connection connection) {
214214
System.err.println( "!!!Error trying to reset synchronization registry!!!" );
215215
}
216216
try {
217-
delegate.closeConnection( connection );
217+
delegate.closeConnection( ((ConnectionWrapper) connection).delegate );
218218
}
219219
catch (SQLException e) {
220220
System.err.println( "!!!Error trying to close JDBC connection from delist callbacks!!!" );

0 commit comments

Comments
 (0)