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-8178: Added option allowCoreThreadTimeout to thread pool / thread pool profile.
Date Wed, 24 Dec 2014 12:10:33 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7c8817ced -> 6f41a86d6


CAMEL-8178: Added option allowCoreThreadTimeout to thread pool / thread pool profile.


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

Branch: refs/heads/master
Commit: 6f41a86d6d315b0f0d54023ecfbb9c557dcef40e
Parents: 7c8817c
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Dec 24 13:10:24 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Dec 24 13:10:24 2014 +0100

----------------------------------------------------------------------
 .../camel/api/management/mbean/ManagedThreadPoolMBean.java   | 6 ++++++
 .../org/apache/camel/management/mbean/ManagedThreadPool.java | 8 ++++++++
 .../camel/management/ManagedThreadPoolProfileTest.java       | 4 ++++
 .../org/apache/camel/management/ManagedThreadPoolTest.java   | 3 +++
 4 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6f41a86d/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedThreadPoolMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedThreadPoolMBean.java
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedThreadPoolMBean.java
index eea31f3..49eafef 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedThreadPoolMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedThreadPoolMBean.java
@@ -78,6 +78,12 @@ public interface ManagedThreadPoolMBean {
     @ManagedAttribute(description = "Keep alive time in seconds")
     void setKeepAliveTime(long keepAliveTimeInSeconds);
 
+    @ManagedAttribute(description = "Whether core threads is allowed to timeout if no tasks
in queue to process")
+    boolean isAllowCoreThreadTimeout();
+
+    @ManagedAttribute(description = "Whether core threads is allowed to timeout if no tasks
in queue to process")
+    void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout);
+
     @ManagedAttribute(description = "Is shutdown")
     boolean isShutdown();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6f41a86d/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThreadPool.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThreadPool.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThreadPool.java
index a19ccf7..817a153 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThreadPool.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThreadPool.java
@@ -143,6 +143,14 @@ public class ManagedThreadPool implements ManagedThreadPoolMBean {
         threadPool.setKeepAliveTime(keepAliveTimeInSeconds, TimeUnit.SECONDS);
     }
 
+    public boolean isAllowCoreThreadTimeout() {
+        return threadPool.allowsCoreThreadTimeOut();
+    }
+
+    public void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) {
+        threadPool.allowCoreThreadTimeOut(allowCoreThreadTimeout);
+    }
+
     public boolean isShutdown() {
         return threadPool.isShutdown();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/6f41a86d/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolProfileTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolProfileTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolProfileTest.java
index 9ad47c8..219eef5 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolProfileTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolProfileTest.java
@@ -53,6 +53,9 @@ public class ManagedThreadPoolProfileTest extends ManagementTestSupport
{
         Long keepAlive = (Long) mbeanServer.getAttribute(on, "KeepAliveTime");
         assertEquals(25, keepAlive.intValue());
 
+        Boolean allow = (Boolean) mbeanServer.getAttribute(on, "AllowCoreThreadTimeout");
+        assertEquals(true, allow.booleanValue());
+
         getMockEndpoint("mock:result").expectedMessageCount(1);
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();
@@ -81,6 +84,7 @@ public class ManagedThreadPoolProfileTest extends ManagementTestSupport
{
                 profile.setMaxPoolSize(15);
                 profile.setKeepAliveTime(25L);
                 profile.setMaxQueueSize(250);
+                profile.setAllowCoreThreadTimeOut(true);
                 profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);
 
                 context.getExecutorServiceManager().registerThreadPoolProfile(profile);

http://git-wip-us.apache.org/repos/asf/camel/blob/6f41a86d/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolTest.java
b/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolTest.java
index 188cf6d..15620ca 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedThreadPoolTest.java
@@ -51,6 +51,9 @@ public class ManagedThreadPoolTest extends ManagementTestSupport {
         Long keepAlive = (Long) mbeanServer.getAttribute(on, "KeepAliveTime");
         assertEquals(60, keepAlive.intValue());
 
+        Boolean allow = (Boolean) mbeanServer.getAttribute(on, "AllowCoreThreadTimeout");
+        assertEquals(false, allow.booleanValue());
+
         getMockEndpoint("mock:result").expectedMessageCount(1);
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();


Mime
View raw message