You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/07/26 20:33:51 UTC

[2/2] camel git commit: CAMEL-9014: More endpoint usage statitics on the runtime endpoint mbean

CAMEL-9014: More endpoint usage statitics on the runtime endpoint mbean


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1ceb5c70
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1ceb5c70
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1ceb5c70

Branch: refs/heads/master
Commit: 1ceb5c70d75bab2c16779376f8f6edf868705ed3
Parents: 29cef6f
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jul 26 20:38:50 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jul 26 20:38:50 2015 +0200

----------------------------------------------------------------------
 .../camel/api/management/mbean/CamelOpenMBeanTypes.java      | 8 ++++----
 .../management/mbean/ManagedRuntimeEndpointRegistry.java     | 8 ++++++--
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1ceb5c70/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
index 32de297..093d794 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/CamelOpenMBeanTypes.java
@@ -68,13 +68,13 @@ public final class CamelOpenMBeanTypes {
 
     public static TabularType listRuntimeEndpointsTabularType() throws OpenDataException {
         CompositeType ct = listRuntimeEndpointsCompositeType();
-        return new TabularType("listRuntimeEndpoints", "Lists all the input and output endpoints gathered during runtime", ct, new String[]{"url"});
+        return new TabularType("listRuntimeEndpoints", "Lists all the input and output endpoints gathered during runtime", ct, new String[]{"index"});
     }
 
     public static CompositeType listRuntimeEndpointsCompositeType() throws OpenDataException {
-        return new CompositeType("endpoints", "Endpoints", new String[]{"url", "routeId", "direction", "static", "dynamic"},
-                new String[]{"Url", "Route Id", "Direction", "Static", "Dynamic"},
-                new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN});
+        return new CompositeType("endpoints", "Endpoints", new String[]{"index", "url", "routeId", "direction", "static", "dynamic"},
+                new String[]{"Index", "Url", "Route Id", "Direction", "Static", "Dynamic"},
+                new OpenType[]{SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN});
     }
 
     public static TabularType explainComponentTabularType() throws OpenDataException {

http://git-wip-us.apache.org/repos/asf/camel/blob/1ceb5c70/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRuntimeEndpointRegistry.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRuntimeEndpointRegistry.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRuntimeEndpointRegistry.java
index daafe91..0679047 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRuntimeEndpointRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRuntimeEndpointRegistry.java
@@ -90,6 +90,7 @@ public class ManagedRuntimeEndpointRegistry extends ManagedService implements Ma
             TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listRuntimeEndpointsTabularType());
 
             EndpointRegistry staticRegistry = getContext().getEndpointRegistry();
+            int index = 0;
 
             for (RuntimeEndpointRegistry.Statistic stat : registry.getEndpointStatistics()) {
                 CompositeType ct = CamelOpenMBeanTypes.listRuntimeEndpointsCompositeType();
@@ -103,9 +104,12 @@ public class ManagedRuntimeEndpointRegistry extends ManagedService implements Ma
                 String routeId = stat.getRouteId();
                 String direction = stat.getDirection();
 
-                CompositeData data = new CompositeDataSupport(ct, new String[]{"url", "routeId", "direction", "static", "dynamic"},
-                        new Object[]{url, routeId, direction, isStatic, isDynamic});
+                CompositeData data = new CompositeDataSupport(ct, new String[]{"index", "url", "routeId", "direction", "static", "dynamic"},
+                        new Object[]{index, url, routeId, direction, isStatic, isDynamic});
                 answer.put(data);
+
+                // use a counter as the single index in the TabularData as we do not want a multi-value index
+                index++;
             }
             return answer;
         } catch (Exception e) {