Package org.hibernate.stat.spi

Examples of org.hibernate.stat.spi.StatisticsFactory


  private StatisticsImplementor initiateServiceInternal(
      SessionFactoryImplementor sessionFactory,
      Object configValue,
      ServiceRegistryImplementor registry) {

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
  }
View Full Code Here


  private StatisticsImplementor initiateServiceInternal(
      SessionFactoryImplementor sessionFactory,
      Object configValue,
      ServiceRegistryImplementor registry) {

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
  }
View Full Code Here

      SessionFactoryImplementor sessionFactory,
      Configuration configuration,
      ServiceRegistryImplementor registry) {
    final Object configValue = configuration.getProperties().get( STATS_BUILDER );

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
View Full Code Here

      SessionFactoryImplementor sessionFactory,
      Configuration configuration,
      ServiceRegistryImplementor registry) {
    final Object configValue = configuration.getProperties().get( STATS_BUILDER );

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
View Full Code Here

  private StatisticsImplementor initiateServiceInternal(
      SessionFactoryImplementor sessionFactory,
      Object configValue,
      ServiceRegistryImplementor registry) {

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
  }
View Full Code Here

  private StatisticsImplementor initiateServiceInternal(
      SessionFactoryImplementor sessionFactory,
      Object configValue,
      ServiceRegistryImplementor registry) {

    StatisticsFactory statisticsFactory;
    if ( configValue == null ) {
      statisticsFactory = DEFAULT_STATS_BUILDER;
    }
    else if ( StatisticsFactory.class.isInstance( configValue ) ) {
      statisticsFactory = (StatisticsFactory) configValue;
    }
    else {
      // assume it names the factory class
      final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
      try {
        statisticsFactory = (StatisticsFactory) classLoaderService.classForName( configValue.toString() ).newInstance();
      }
      catch (HibernateException e) {
        throw e;
      }
      catch (Exception e) {
        throw new HibernateException(
            "Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
            e
        );
      }
    }

    StatisticsImplementor statistics = statisticsFactory.buildStatistics( sessionFactory );
    final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
    statistics.setStatisticsEnabled( enabled );
    LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
    return statistics;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.stat.spi.StatisticsFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.