private void initJMXAgent() throws Exception {
if (camelJMXAgent != null && camelJMXAgent.isDisabled()) {
LOG.info("JMXAgent disabled");
getContext().setLifecycleStrategy(new DefaultLifecycleStrategy());
} else if (camelJMXAgent != null) {
DefaultInstrumentationAgent agent = new DefaultInstrumentationAgent();
agent.setConnectorPort(camelJMXAgent.getConnectorPort());
agent.setCreateConnector(camelJMXAgent.isCreateConnector());
agent.setMBeanObjectDomainName(camelJMXAgent.getMbeanObjectDomainName());
agent.setMBeanServerDefaultDomain(camelJMXAgent.getMbeanServerDefaultDomain());
agent.setRegistryPort(camelJMXAgent.getRegistryPort());
agent.setServiceUrlPath(camelJMXAgent.getServiceUrlPath());
agent.setUsePlatformMBeanServer(camelJMXAgent.isUsePlatformMBeanServer());
agent.setOnlyRegisterProcessorWithCustomId(camelJMXAgent.getOnlyRegisterProcessorWithCustomId());
LOG.info("JMXAgent enabled: " + camelJMXAgent);
getContext().setLifecycleStrategy(new InstrumentationLifecycleStrategy(agent));
}
}