HHH-8930 corrected overzealous commit

This commit is contained in:
Brett Meyer 2014-02-10 13:56:11 -05:00
parent 9fa9c734da
commit bfd63f1fec

View File

@ -379,7 +379,6 @@ private void releaseSessionFactory() {
} }
sessionFactory.close(); sessionFactory.close();
sessionFactory = null; sessionFactory = null;
configuration = null;
if(serviceRegistry == null){ if(serviceRegistry == null){
return; return;
} }
@ -392,20 +391,12 @@ private void releaseSessionFactory() {
@SuppressWarnings( {"UnusedDeclaration"}) @SuppressWarnings( {"UnusedDeclaration"})
public void onFailure() { public void onFailure() {
if ( rebuildSessionFactoryOnError() ) { if ( rebuildSessionFactoryOnError() ) {
releaseSessionFactory();
rebuildSessionFactory(); rebuildSessionFactory();
} }
} }
protected void rebuildSessionFactory() { protected void rebuildSessionFactory() {
if ( sessionFactory == null ) {
return;
}
sessionFactory.close();
sessionFactory = null;
configuration = null;
serviceRegistry.destroy();
serviceRegistry = null;
serviceRegistry = buildServiceRegistry( configuration ); serviceRegistry = buildServiceRegistry( configuration );
if ( isMetadataUsed ) { if ( isMetadataUsed ) {
// need to rebuild metadata because serviceRegistry was recreated // need to rebuild metadata because serviceRegistry was recreated