MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
if (server != null) {
// gather all the routes for this CamelContext, which requires JMX
ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=routes,*");
Set<ObjectName> routes = server.queryNames(query, null);
Set<ManagedProcessorMBean> processors = new LinkedHashSet<ManagedProcessorMBean>();
if (includeProcessors) {
// gather all the processors for this CamelContext, which requires JMX
query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");