StatisticsService.java | Class | JMX service for Hibernate statistics
Register this MBean in your JMX server for a specific session factory
//build the ObjectName you want
Hashtable tb = new Hashtable();
tb.put("type", "statistics");
tb.put("sessionFactory", "myFinancialApp");
ObjectName on = new ObjectName("hibernate", tb);
StatisticsService stats = new StatisticsService();
stats.setSessionFactory(sessionFactory);
server.registerMBean(stats, on);
And call the MBean the way you want
Register this MBean in your JMX server with no specific session factory
//build the ObjectName you want
Hashtable tb = new Hashtable();
tb.put("type", "statistics");
tb.put("sessionFactory", "myFinancialApp");
ObjectName on = new ObjectName("hibernate", tb);
StatisticsService stats = new StatisticsService();
server.registerMBean(stats, on);
And call the MBean by providing the SessionFactoryJNDIName first. |