org.hibernate.SessionFactory.isClosed()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.hibernate.SessionFactory.isClosed()方法的一些代码示例,展示了SessionFactory.isClosed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionFactory.isClosed()方法的具体详情如下:
包路径:org.hibernate.SessionFactory
类名称:SessionFactory
方法名:isClosed

SessionFactory.isClosed介绍

[英]Is this factory already closed?
[中]这家工厂已经关门了吗?

代码示例

代码示例来源:origin: openmrs/openmrs-core

/**
 * @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");
  }
  
}

代码示例来源:origin: Impetus/Kundera

@Override
public void destroy()
{
  unload();
  if (sf != null && !sf.isClosed())
  {
    sf.close();
    sf = null;
  }
  indexManager.close();
  externalProperties = null;
}

代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate5-core

@Override
public boolean isClosed() {
  return delegate.isClosed();
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public boolean isOpen() {
  return ! sessionFactory.isClosed();
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb

public boolean isOpen() {
  return ! sessionFactory.isClosed();
}

代码示例来源:origin: picocontainer/picocontainer

/** {@inheritDoc} **/
public boolean isClosed() {
  return delegate.isClosed();
}

代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate4-core

@Override
public boolean isClosed() {
  return delegate.isClosed();
}

代码示例来源:origin: picocontainer/picocontainer

/** {@inheritDoc} **/
public boolean isClosed() {
  return delegate.isClosed();
}

代码示例来源:origin: hibernate/hibernate-entitymanager

public boolean isOpen() {
  return ! sessionFactory.isClosed();
}

代码示例来源:origin: net.krotscheck/kangaroo-common

/**
 * 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();
  }
}

代码示例来源:origin: com.carbonfive/db-support

public boolean isClosed()
{
  return getSessionFactory().isClosed();
}

代码示例来源:origin: org.grails/grails-hibernate

public boolean isClosed() {
  return getCurrentSessionFactory().isClosed();
}

代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-jpa-int

public boolean isClosed()
{
 return getSessionFactory().isClosed();
}

代码示例来源:origin: stackoverflow.com

SessionFactory sessionFactory = null;
Session session = null;

try{
  do some stuff
catch(Exception e){

} finally {
 if (!sessionFactory.isClosed()) {
      session.close();
      sessionFactory.close();
    }
}

代码示例来源:origin: org.nuiton.topia/topia-persistence

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();
  }
}

代码示例来源:origin: com.impetus.kundera.client/kundera-rdbms

@Override
public void destroy()
{
  unload();
  if (sf != null && !sf.isClosed())
  {
    sf.close();
    sf = null;
  }
  indexManager.close();
  externalProperties = null;
}

代码示例来源:origin: com.impetus.client/kundera-rdbms

@Override
public void destroy()
{
  unload();
  if (sf != null && !sf.isClosed())
  {
    sf.close();
    sf = null;
  }
  indexManager.close();
  externalProperties = null;
}

代码示例来源:origin: hibernate/hibernate-search

private boolean isActive(TestResourceManager manager) {
  return !manager.getSessionFactory().isClosed();
}

代码示例来源:origin: hibernate/hibernate-ogm

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 );
    }
  }
}

代码示例来源:origin: hibernate/hibernate-ogm

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 );
    }
  }
}

相关文章