This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a66028  CAMEL-13093 (#2724)
1a66028 is described below

commit 1a660284104871f036548b7aa4c2d2676e4eaf7c
Author: 1984shekhar <chandrashekharpan...@hotmail.com>
AuthorDate: Tue Jan 22 01:02:33 2019 +0530

    CAMEL-13093 (#2724)
    
    * karaf route-profile command improvement
    
    * CAMEL-13093: karaf route-profile command improvement
---
 .../apache/camel/commands/AbstractLocalCamelController.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
index a07cf12..28a148f 100644
--- 
a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
+++ 
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
@@ -392,13 +392,11 @@ public abstract class AbstractLocalCamelController 
extends AbstractCamelControll
         ManagementAgent agent = 
context.getManagementStrategy().getManagementAgent();
         if (agent != null) {
             MBeanServer mBeanServer = agent.getMBeanServer();
-            Set<ObjectName> set = mBeanServer.queryNames(new 
ObjectName(agent.getMBeanObjectDomainName() + ":type=routes,name=\"" + routeId 
+ "\",*"), null);
-            Iterator<ObjectName> iterator = set.iterator();
-            if (iterator.hasNext()) {
-                ObjectName routeMBean = iterator.next();
-
-                // the route must be part of the camel context
-                String camelId = (String) mBeanServer.getAttribute(routeMBean, 
"CamelId");
+            Set<ObjectName> set = mBeanServer.queryNames(new 
ObjectName(agent.getMBeanObjectDomainName() + ":type=routes,name=\"" + routeId 
+ "\",*"), null);            
+            for (ObjectName routeMBean : set) {
+               
+               // the route must be part of the camel context
+               String camelId = (String) mBeanServer.getAttribute(routeMBean, 
"CamelId");
                 if (camelId != null && camelId.equals(camelContextName)) {
                     String xml = (String) mBeanServer.invoke(routeMBean, 
"dumpRouteStatsAsXml", new Object[]{fullStats, includeProcessors}, new 
String[]{"boolean", "boolean"});
                     return xml;

Reply via email to