mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-07 03:38:16 +00:00
HHH-6792 connection leaks due to service registry is not destroyed
This commit is contained in:
parent
192682d31b
commit
70bd57bcff
@ -229,7 +229,7 @@ public Connection obtainConnection() throws SQLException {
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection connection) throws SQLException {
|
||||
connection.close();
|
||||
connectionProvider.closeConnection( connection );
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public Connection obtainConnection() throws SQLException {
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection connection) throws SQLException {
|
||||
connection.close();
|
||||
connectionProvider.releaseAnyConnection( connection );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ protected <R extends Service> void startService(ServiceBinding<R> serviceBinding
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
ListIterator<Service> serviceIterator = serviceList.listIterator( serviceList.size() );
|
||||
while ( serviceIterator.hasPrevious() ) {
|
||||
|
@ -365,6 +365,11 @@ private void releaseSessionFactory() {
|
||||
sessionFactory.close();
|
||||
sessionFactory = null;
|
||||
configuration = null;
|
||||
if(serviceRegistry == null){
|
||||
return;
|
||||
}
|
||||
serviceRegistry.destroy();
|
||||
serviceRegistry=null;
|
||||
}
|
||||
|
||||
@OnFailure
|
||||
|
Loading…
x
Reference in New Issue
Block a user