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