/** * @see org.openmrs.api.context.Context#shutdown() */ @Override public void shutdown() { if (log.isInfoEnabled()) { showUsageStatistics(); } if (sessionFactory != null) { log.debug("Closing any open sessions"); closeSession(); log.debug("Shutting down threadLocalSession factory"); if (!sessionFactory.isClosed()) { sessionFactory.close(); } log.debug("The threadLocalSession has been closed"); } else { log.error("SessionFactory is null"); } }
@Override public void destroy() { unload(); if (sf != null && !sf.isClosed()) { sf.close(); sf = null; } indexManager.close(); externalProperties = null; }
@Override public boolean isClosed() { return delegate.isClosed(); }
public boolean isOpen() { return ! sessionFactory.isClosed(); }
public boolean isOpen() { return ! sessionFactory.isClosed(); }
/** {@inheritDoc} **/ public boolean isClosed() { return delegate.isClosed(); }
@Override public boolean isClosed() { return delegate.isClosed(); }
/** {@inheritDoc} **/ public boolean isClosed() { return delegate.isClosed(); }
public boolean isOpen() { return ! sessionFactory.isClosed(); }
/** * Dispose of the hibernate session. * * @param sessionFactory The session to dispose. */ @Override public void dispose(final SessionFactory sessionFactory) { if (sessionFactory != null && !sessionFactory.isClosed()) { logger.debug("Disposing of hibernate session factory."); sessionFactory.close(); } }
public boolean isClosed() { return getSessionFactory().isClosed(); }
public boolean isClosed() { return getCurrentSessionFactory().isClosed(); }
public boolean isClosed() { return getSessionFactory().isClosed(); }
SessionFactory sessionFactory = null; Session session = null; try{ do some stuff catch(Exception e){ } finally { if (!sessionFactory.isClosed()) { session.close(); sessionFactory.close(); } }
public void close() { metaData = null; if (hibernateSessionFactory != null) { Preconditions.checkState(!hibernateSessionFactory.isClosed()); // close connection provider if possible (http://nuiton.org/issues/2757) ConnectionProvider service = getHibernateService(hibernateSessionFactory, ConnectionProvider.class); if (service instanceof Stoppable) { Stoppable stoppable = (Stoppable) service; stoppable.stop(); } hibernateSessionFactory.close(); } }
@Override public void destroy() { unload(); if (sf != null && !sf.isClosed()) { sf.close(); sf = null; } indexManager.close(); externalProperties = null; }
@Override public void destroy() { unload(); if (sf != null && !sf.isClosed()) { sf.close(); sf = null; } indexManager.close(); externalProperties = null; }
private boolean isActive(TestResourceManager manager) { return !manager.getSessionFactory().isClosed(); }
public static void dropSchemaAndDatabase(SessionFactory sessionFactory) { // if the factory is closed, we don't have access to the service registry if ( sessionFactory != null && !sessionFactory.isClosed() ) { try { HELPER.dropSchemaAndDatabase( sessionFactory ); } catch ( Exception e ) { log.warn( "Exception while dropping schema and database in test", e ); } } }
public static void prepareDatabase(SessionFactory sessionFactory) { // if the factory is closed, we don't have access to the service registry if ( sessionFactory != null && !sessionFactory.isClosed() ) { try { HELPER.prepareDatabase( sessionFactory ); } catch ( Exception e ) { log.warn( "Exception while preparing schema and database in test", e ); } } }