protected void registerStatisticsService() throws NotCompliantMBeanException, MBeanRegistrationException,
InstanceAlreadyExistsException, MalformedObjectNameException
{
ObjectName on = jmxSupport.getObjectName(String.format("%s:%s", jmxSupport.getDomainName(muleContext, !containerMode), StatisticsServiceMBean.DEFAULT_JMX_NAME));
StatisticsService service = new StatisticsService();
service.setMuleContext(muleContext);
service.setEnabled(isEnableStatistics());
ClassloaderSwitchingMBeanWrapper mBean = new ClassloaderSwitchingMBeanWrapper(service, StatisticsServiceMBean.class, muleContext.getExecutionClassLoader());
logger.debug("Registering statistics with name: " + on);
mBeanServer.registerMBean(mBean, on);
}