Repository: camel
Updated Branches:
  refs/heads/master 16cc8a920 -> 8c6de215e


Use ManagedLoadTimer as JMX name in threadpools to better indicate what the 
pool does. Its the JMX background thread for load statistics.


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

Branch: refs/heads/master
Commit: 8c6de215ebfac20f9e399c1a5ec87fce74c40494
Parents: 16cc8a9
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Mar 21 11:25:36 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Mar 21 11:25:36 2015 +0100

----------------------------------------------------------------------
 .../DefaultManagementLifecycleStrategy.java     | 14 ++++-----
 .../camel/management/ManagedLoadTimer.java      | 31 ++++++++++++++++++++
 .../camel/support/TimerListenerManager.java     |  4 +--
 3 files changed, 39 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8c6de215/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
index 4834d64..33d713b 100644
--- 
a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
@@ -118,8 +118,8 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
     private final Map<Processor, KeyValueHolder<ProcessorDefinition<?>, 
InstrumentationProcessor>> wrappedProcessors =
             new HashMap<Processor, KeyValueHolder<ProcessorDefinition<?>, 
InstrumentationProcessor>>();
     private final List<PreRegisterService> preServices = new 
ArrayList<PreRegisterService>();
-    private final TimerListenerManager timerListenerManager = new 
TimerListenerManager();
-    private final TimerListenerManagerStartupListener 
timerManagerStartupListener = new TimerListenerManagerStartupListener();
+    private final TimerListenerManager loadTimer = new ManagedLoadTimer();
+    private final TimerListenerManagerStartupListener loadTimerStartupListener 
= new TimerListenerManagerStartupListener();
     private volatile CamelContext camelContext;
     private volatile ManagedCamelContext camelContextMBean;
     private volatile boolean initialized;
@@ -821,7 +821,7 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
         getManagementStrategy().manageObject(me);
         if (me instanceof TimerListener) {
             TimerListener timer = (TimerListener) me;
-            timerListenerManager.addTimerListener(timer);
+            loadTimer.addTimerListener(timer);
         }
     }
 
@@ -834,7 +834,7 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
     protected void unmanageObject(Object me) throws Exception {
         if (me instanceof TimerListener) {
             TimerListener timer = (TimerListener) me;
-            timerListenerManager.removeTimerListener(timer);
+            loadTimer.removeTimerListener(timer);
         }
         getManagementStrategy().unmanageObject(me);
     }
@@ -900,7 +900,7 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
         ObjectHelper.notNull(camelContext, "CamelContext");
 
         // defer starting the timer manager until CamelContext has been fully 
started
-        camelContext.addStartupListener(timerManagerStartupListener);
+        camelContext.addStartupListener(loadTimerStartupListener);
     }
 
     private final class TimerListenerManagerStartupListener implements 
StartupListener {
@@ -914,9 +914,9 @@ public class DefaultManagementLifecycleStrategy extends 
ServiceSupport implement
             LOG.debug("Load performance statistics {}", disabled ? "disabled" 
: "enabled");
             if (!disabled) {
                 // must use 1 sec interval as the load statistics is based on 
1 sec calculations
-                timerListenerManager.setInterval(1000);
+                loadTimer.setInterval(1000);
                 // we have to defer enlisting timer lister manager as a 
service until CamelContext has been started
-                getCamelContext().addService(timerListenerManager);
+                getCamelContext().addService(loadTimer);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8c6de215/camel-core/src/main/java/org/apache/camel/management/ManagedLoadTimer.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/management/ManagedLoadTimer.java 
b/camel-core/src/main/java/org/apache/camel/management/ManagedLoadTimer.java
new file mode 100644
index 0000000..0e487c7
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/management/ManagedLoadTimer.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.management;
+
+import org.apache.camel.support.TimerListenerManager;
+
+/**
+ * The {@link org.apache.camel.support.TimerListenerManager} used for tracking 
load statistics.
+ * <p/>
+ * From Camel 2.13 onwards the {@link ManagedLoadTimer} is only enabled if
+ * {@link org.apache.camel.spi.ManagementStrategy#isLoadStatisticsEnabled()} 
is enabled.
+ */
+public class ManagedLoadTimer extends TimerListenerManager {
+
+    // empty on purpose
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8c6de215/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java 
b/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
index 793e9cd..ae489c7 100644
--- 
a/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
+++ 
b/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
@@ -36,11 +36,9 @@ import org.slf4j.LoggerFactory;
  * <p/>
  * Also ensure when adding and remove listeners, that they are correctly 
removed to avoid
  * leaking memory.
- * <p/>
- * From Camel 2.13 onwards the {@link TimerListenerManager} is only enabled if
- * {@link org.apache.camel.spi.ManagementStrategy#isLoadStatisticsEnabled()} 
is enabled.
  *
  * @see TimerListener
+ * @see org.apache.camel.management.ManagedLoadTimer
  */
 public class TimerListenerManager extends ServiceSupport implements Runnable, 
CamelContextAware, StaticService {
 

Reply via email to