HHH-6792 connection leaks due to service registry is not destroyed

This commit is contained in:
Strong Liu 2011-11-02 17:37:05 +08:00
parent 192682d31b
commit 70bd57bcff
3 changed files with 8 additions and 3 deletions

View File

@ -229,7 +229,7 @@ public class JdbcServicesImpl implements JdbcServices, ServiceRegistryAwareServi
@Override
public void releaseConnection(Connection connection) throws SQLException {
connection.close();
connectionProvider.closeConnection( connection );
}
}
@ -247,7 +247,7 @@ public class JdbcServicesImpl implements JdbcServices, ServiceRegistryAwareServi
@Override
public void releaseConnection(Connection connection) throws SQLException {
connection.close();
connectionProvider.releaseAnyConnection( connection );
}
}

View File

@ -252,7 +252,7 @@ public abstract class AbstractServiceRegistryImpl implements ServiceRegistryImpl
);
}
}
@Override
public void destroy() {
ListIterator<Service> serviceIterator = serviceList.listIterator( serviceList.size() );
while ( serviceIterator.hasPrevious() ) {

View File

@ -365,6 +365,11 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
sessionFactory.close();
sessionFactory = null;
configuration = null;
if(serviceRegistry == null){
return;
}
serviceRegistry.destroy();
serviceRegistry=null;
}
@OnFailure