camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8044: Camel commands useable for remote JVMs using jolokia
Date Tue, 16 Dec 2014 14:54:25 GMT
Repository: camel
Updated Branches:
  refs/heads/master a2ad7d12e -> a2300894c


CAMEL-8044: Camel commands useable for remote JVMs using jolokia


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

Branch: refs/heads/master
Commit: a2300894c0558ce6f7c83d991e97017fd8ce0b0a
Parents: a2ad7d1
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Dec 16 15:54:14 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Dec 16 15:54:14 2014 +0100

----------------------------------------------------------------------
 .../commands/AbstractLocalCamelController.java  | 19 ++++++++++
 .../camel/commands/ContextInfoCommand.java      | 40 +++++++++-----------
 .../jolokia/DefaultJolokiaCamelController.java  |  1 +
 3 files changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a2300894/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractLocalCamelController.java
----------------------------------------------------------------------
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 c2973ac..2ee1f57 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
@@ -79,6 +79,25 @@ public abstract class AbstractLocalCamelController extends AbstractCamelControll
             for (Map.Entry<String, String> entry : context.getProperties().entrySet())
{
                 answer.put("property." + entry.getKey(), entry.getValue());
             }
+
+            answer.put("typeConverter.statisticsEnabled", context.getTypeConverterRegistry().getStatistics().isStatisticsEnabled());
+            answer.put("typeConverter.attemptCounter", context.getTypeConverterRegistry().getStatistics().getAttemptCounter());
+            answer.put("typeConverter.hitCounter", context.getTypeConverterRegistry().getStatistics().getHitCounter());
+            answer.put("typeConverter.missCounter", context.getTypeConverterRegistry().getStatistics().getMissCounter());
+            answer.put("typeConverter.failedCounter", context.getTypeConverterRegistry().getStatistics().getFailedCounter());
+
+            long activeRoutes = 0;
+            long inactiveRoutes = 0;
+            List<Route> routeList = context.getRoutes();
+            for (Route route : routeList) {
+                if (context.getRouteStatus(route.getId()).isStarted()) {
+                    activeRoutes++;
+                } else {
+                    inactiveRoutes++;
+                }
+            }
+            answer.put("startedRoutes", activeRoutes);
+            answer.put("totalRoutes", activeRoutes + inactiveRoutes);
         }
 
         return answer;

http://git-wip-us.apache.org/repos/asf/camel/blob/a2300894/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
index 66a7edc..53cd624 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/ContextInfoCommand.java
@@ -96,6 +96,24 @@ public class ContextInfoCommand extends AbstractCamelCommand {
             out.println(stringEscape.unescapeJava("\tApplicationContextClassLoader: " + row.get("applicationContextClassLoader")));
 
             printStatistics(camelController, out);
+
+            // add type converter statistics if enabled
+            boolean enabled = false;
+            if (row.get("typeConverter.statisticsEnabled") != null) {
+                enabled = (boolean) row.get("typeConverter.statisticsEnabled");
+            }
+            if (enabled) {
+                long attempt = (long) row.get("typeConverter.attemptCounter");
+                long hit = (long) row.get("typeConverter.hitCounter");
+                long miss = (long) row.get("typeConverter.missCounter");
+                long failed = (long) row.get("typeConverter.failedCounter");
+                out.println(stringEscape.unescapeJava(String.format("\tTypeConverterRegistry
utilization: [attempts=%s, hits=%s, misses=%s, failures=%s]", attempt, hit, miss, failed)));
+            }
+
+            long totalRoutes = (long) row.get("totalRoutes");
+            long startedRoutes = (long) row.get("totalRoutes");
+            out.println(stringEscape.unescapeJava("\tNumber of running routes: " + startedRoutes));
+            out.println(stringEscape.unescapeJava("\tNumber of not running routes: " + (totalRoutes
- startedRoutes)));
         }
 
         return null;
@@ -156,14 +174,6 @@ public class ContextInfoCommand extends AbstractCamelCommand {
 
             // TODO: put that info in the controller
             /*
-                // add type converter statistics if enabled
-                if (camelContext.getTypeConverterRegistry().getStatistics().isStatisticsEnabled())
{
-                    out.println(stringEscape.unescapeJava(String.format("\tTypeConverterRegistry
utilization: [attempts=%s, hits=%s, misses=%s, failures=%s]",
-                            camelContext.getTypeConverterRegistry().getStatistics().getAttemptCounter(),
-                            camelContext.getTypeConverterRegistry().getStatistics().getHitCounter(),
-                            camelContext.getTypeConverterRegistry().getStatistics().getMissCounter(),
-                            camelContext.getTypeConverterRegistry().getStatistics().getFailedCounter())));
-                }
 
                 // add stream caching details if enabled
                 if (camelContext.getStreamCachingStrategy().isEnabled()) {
@@ -192,20 +202,6 @@ public class ContextInfoCommand extends AbstractCamelCommand {
                                         printUnitFromBytes(camelContext.getStreamCachingStrategy().getStatistics().getCacheSpoolAverageSize()))));
                     }
                 }
-
-                long activeRoutes = 0;
-                long inactiveRoutes = 0;
-                List<Route> routeList = camelContext.getRoutes();
-                for (Route route : routeList) {
-                    if (camelContext.getRouteStatus(route.getId()).isStarted()) {
-                        activeRoutes++;
-                    } else {
-                        inactiveRoutes++;
-                    }
-                }
-
-                out.println(stringEscape.unescapeJava("\tNumber of running routes: " + activeRoutes));
-                out.println(stringEscape.unescapeJava("\tNumber of not running routes: "
+ inactiveRoutes));
             }*/
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a2300894/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
index b747e1b..6462cff 100644
--- a/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
+++ b/platforms/commands/commands-jolokia/src/main/java/org/apache/camel/commands/jolokia/DefaultJolokiaCamelController.java
@@ -120,6 +120,7 @@ public class DefaultJolokiaCamelController extends AbstractCamelController
imple
             TimeUnit unit = TimeUnit.valueOf((String) answer.get("timeUnit"));
             long timeout = (Long) answer.get("timeout");
             answer.put("shutdownTimeout", "" + unit.toSeconds(timeout));
+            answer.put("applicationContextClassLoader", answer.get("applicationContextClassName"));
         }
 
         return answer;


Mime
View raw message