Author: davsclaus
Date: Wed Apr 10 09:59:41 2013
New Revision: 1466411
URL: http://svn.apache.org/r1466411
Log:
CAMEL-6259: Fixed so scheduled thread pools get unregister from jmx.
Added:
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/management/ManagedRemoveRouteAggregateThreadPoolTest.java
- copied unchanged from r1466410,
camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRemoveRouteAggregateThreadPoolTest.java
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1466410
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java?rev=1466411&r1=1466410&r2=1466411&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
(original)
+++
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
Wed Apr 10 09:59:41 2013
@@ -254,8 +254,14 @@ public class DefaultExecutorServiceManag
LOG.trace("Shutdown ExecutorService: {} complete.",
executorService);
}
+ // let lifecycle strategy be notified as well which can let it be
managed in JMX as well
+ ThreadPoolExecutor threadPool = null;
if (executorService instanceof ThreadPoolExecutor) {
- ThreadPoolExecutor threadPool = (ThreadPoolExecutor)
executorService;
+ threadPool = (ThreadPoolExecutor) executorService;
+ } else if (executorService instanceof SizedScheduledExecutorService) {
+ threadPool = ((SizedScheduledExecutorService)
executorService).getScheduledThreadPoolExecutor();
+ }
+ if (threadPool != null) {
for (LifecycleStrategy lifecycle :
camelContext.getLifecycleStrategies()) {
lifecycle.onThreadPoolRemove(camelContext, threadPool);
}
@@ -280,8 +286,14 @@ public class DefaultExecutorServiceManag
LOG.trace("ShutdownNow ExecutorService: {} complete.",
executorService);
}
+ // let lifecycle strategy be notified as well which can let it be
managed in JMX as well
+ ThreadPoolExecutor threadPool = null;
if (executorService instanceof ThreadPoolExecutor) {
- ThreadPoolExecutor threadPool = (ThreadPoolExecutor)
executorService;
+ threadPool = (ThreadPoolExecutor) executorService;
+ } else if (executorService instanceof SizedScheduledExecutorService) {
+ threadPool = ((SizedScheduledExecutorService)
executorService).getScheduledThreadPoolExecutor();
+ }
+ if (threadPool != null) {
for (LifecycleStrategy lifecycle :
camelContext.getLifecycleStrategies()) {
lifecycle.onThreadPoolRemove(camelContext, threadPool);
}
Modified:
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java?rev=1466411&r1=1466410&r2=1466411&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
(original)
+++
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
Wed Apr 10 09:59:41 2013
@@ -52,7 +52,7 @@ public class MultipleLifecycleStrategyTe
List<String> expectedEvents = Arrays.asList("onContextStart",
"onServiceAdd", "onServiceAdd", "onServiceAdd",
"onServiceAdd", "onServiceAdd", "onServiceAdd",
"onServiceAdd", "onServiceAdd",
- "onThreadPoolAdd", "onComponentAdd", "onEndpointAdd",
"onComponentRemove", "onContextStop");
+ "onThreadPoolAdd", "onComponentAdd", "onEndpointAdd",
"onComponentRemove", "onContextStop", "onThreadPoolRemove");
assertEquals(expectedEvents, dummy1.getEvents());
assertEquals(expectedEvents, dummy2.getEvents());