public void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException {
try {
registerMBeanWithServer(obj, name, forceRegistration);
} catch (NotCompliantMBeanException e) {
// If this is not a "normal" MBean, then try to deploy it using JMX annotations
ManagementMBeanAssembler assembler = camelContext.getManagementMBeanAssembler();
ObjectHelper.notNull(assembler, "ManagementMBeanAssembler", camelContext);
Object mbean = assembler.assemble(server, obj, name);
if (mbean != null) {
// and register the mbean
registerMBeanWithServer(mbean, name, forceRegistration);
}
}