Package org.hibernate.jmx

Examples of org.hibernate.jmx.StatisticsService


        }

        if (hibernateStatistics) {
            log.info("registering Hibernate statistics MBean");
            hibernateMBeanName = new ObjectName("Hibernate:type=statistics,application="+appname);
            StatisticsService mBean = new StatisticsService();
            mBean.setSessionFactoryJNDIName("SessionFactories/"+appname+"SF");
            ManagementFactory.getPlatformMBeanServer().registerMBean(mBean, hibernateMBeanName);
        }
       
        Events.instance().raiseEvent("Wiki.startup");
View Full Code Here


      Hashtable<String, String> tb = new Hashtable<String, String>();
      tb.put("type", "statistics");
      tb.put("sessionFactory", "HibernateStatistics");
      ObjectName on = new ObjectName("org.olat.core.persistance", tb);
      MBeanServer server = (MBeanServer) CoreSpringFactory.getBean(MBeanServerFactoryBean.class);
      StatisticsService stats = new StatisticsService();
      stats.setSessionFactory(mySessionFactory);
      server.registerMBean(stats, on);
    } catch (MalformedObjectNameException e) {
        logWarn("JMX-Error : Can not register as MBean, MalformedObjectNameException=", e);
    } catch (InstanceAlreadyExistsException e) {
        logWarn("JMX-Error : Can not register as MBean, InstanceAlreadyExistsException=", e);
View Full Code Here

            else
            {
               serviceName = serviceName + ",type=stats";
            }
            hibernateStatisticsServiceName = serviceName;
            StatisticsService hibernateStatisticsService = new StatisticsService();
            hibernateStatisticsService.setSessionFactory( sessionFactory );
            BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(hibernateStatisticsServiceName, StatisticsService.class.getName());
            StringBuffer buffer = new StringBuffer();
            buffer.append("@").append(JMX.class.getName()).append("(name=\"").append(hibernateStatisticsServiceName).append("JMX\"");
            buffer.append(", exposedInterface=").append(StatisticsServiceMBean.class.getName()).append(".class, registerDirectly=true)");
            String jmxAnnotation = buffer.toString();
View Full Code Here

            if (LOGGER.isLoggable(Level.INFO)) {
                LOGGER.log(Level.INFO, "Unable to register statistics JMX bean", e);
            }
            return;
        }
        StatisticsService stats = new StatisticsService();
        stats.setSessionFactory(sessionFactory);
        try {
            if (on != null) {
                ManagementFactory.getPlatformMBeanServer().registerMBean(stats, on);
            }
        } catch (InstanceAlreadyExistsException e) {
View Full Code Here

                ArrayList<MBeanServer> list = MBeanServerFactory.findMBeanServer(null);
                server = list.get(0);
            }

            ObjectName objectName = new ObjectName(HIBERNATE_STATISTICS_MBEAN_OBJECTNAME);
            StatisticsService mBean = new StatisticsService();
            mBean.setSessionFactory(sessionFactory);
            server.registerMBean(mBean, objectName);
        } catch (InstanceAlreadyExistsException iaee) {
            LOG.info("Duplicate mbean registration ignored: " + HIBERNATE_STATISTICS_MBEAN_OBJECTNAME);
        } catch (Exception e) {
            LOG.warn("Couldn't register hibernate statistics mbean", e);
View Full Code Here

            else
            {
               serviceName = serviceName + ",type=stats";
            }
            hibernateStatisticsServiceName = serviceName;
            StatisticsService hibernateStatisticsService = new StatisticsService();
            hibernateStatisticsService.setSessionFactory( sessionFactory );
            BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(hibernateStatisticsServiceName, StatisticsService.class.getName());
            StringBuffer buffer = new StringBuffer();
            buffer.append("@org.jboss.aop.microcontainer.aspects.jmx.JMX(name=\"").append(hibernateStatisticsServiceName).append("JMX\"");
            buffer.append(", exposedInterface=").append(StatisticsServiceMBean.class.getName()).append(".class, registerDirectly=true)");
            String jmxAnnotation = buffer.toString();
View Full Code Here

  public HibernateStatsReporter(SessionFactory sessionFactory, Logger logger) {
    final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
    if (mbeanServer != null) {
      try {
        ObjectName on = new ObjectName("Hibernate:type=statistics,application=brcm");
        StatisticsService mBean = new StatisticsService();
        mBean.setStatisticsEnabled(true);
        mBean.setSessionFactory(sessionFactory);
        mbeanServer.registerMBean(mBean, on);
        logger.info("Hibernate JMX service enabled.");
      } catch (JMException e) {
        logger.log(Level.WARNING, "Unable to start JMX Hibernate service", e);
      }
View Full Code Here

            .getBean("sessionFactory");
        final MBeanServer mbeanServer = ManagementFactory
            .getPlatformMBeanServer();
        final ObjectName on = new ObjectName(
            "Hibernate:type=statistics,application=appfuse");
        final StatisticsService mBean = new StatisticsService();
        mBean.setStatisticsEnabled(true);
        mBean.setSessionFactory(sessionFactory);
        mbeanServer.registerMBean(mBean, on);
      } catch (InstanceAlreadyExistsException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
            ex);
      } catch (MBeanRegistrationException ex) {
View Full Code Here

TOP

Related Classes of org.hibernate.jmx.StatisticsService

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.