public void sessionFactoryClosed(SessionFactory factory) {
( ( StandardServiceRegistryImpl ) serviceRegistry ).destroy();
}
};
if ( cfg.getSessionFactoryObserver() != null ) {
SessionFactoryObserverChain aggregator = new SessionFactoryObserverChain();
aggregator.addObserver( cfg.getSessionFactoryObserver() );
aggregator.addObserver( serviceRegistryCloser );
cfg.setSessionFactoryObserver( aggregator );
}
else {
cfg.setSessionFactoryObserver( serviceRegistryCloser );
}