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 2010/03/16 10:34:46 UTC

svn commit: r923645 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java

Author: davsclaus
Date: Tue Mar 16 09:34:46 2010
New Revision: 923645

URL: http://svn.apache.org/viewvc?rev=923645&view=rev
Log:
CAMEL-1588: Introduced ThreadPoolProfile with a sensible default used by EIPs. Introduced ThreadPoolBuilder to easily create pools from Java.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java?rev=923645&r1=923644&r2=923645&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java Tue Mar 16 09:34:46 2010
@@ -51,7 +51,7 @@ public class DefaultExecutorServiceStrat
     }
 
     public void setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile) {
-        // the old is no long default
+        // the old is no longer default
         if (this.defaultThreadPoolProfile != null) {
             this.defaultThreadPoolProfile.setDefaultProfile(false);
         }

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java?rev=923645&r1=923644&r2=923645&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java Tue Mar 16 09:34:46 2010
@@ -45,19 +45,21 @@ import static org.apache.camel.util.Obje
 @XmlAccessorType(XmlAccessType.FIELD)
 public class CamelExecutorServiceFactoryBean extends IdentifiedType implements FactoryBean, CamelContextAware, ApplicationContextAware {
 
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Integer poolSize;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Integer maxPoolSize;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     private Integer keepAliveTime = 60;
-    @XmlAttribute(required = false)
+    @XmlAttribute
     @XmlJavaTypeAdapter(TimeUnitAdapter.class)
     private TimeUnit units = TimeUnit.SECONDS;
-    @XmlAttribute(required = false)
+    @XmlAttribute
+    private Integer maxQueueSize = -1;
+    @XmlAttribute
     private String threadName;
     @XmlAttribute
-    private Boolean deamon = Boolean.TRUE;
+    private Boolean daemon = Boolean.TRUE;
     @XmlAttribute
     private String camelContextId;
     @XmlTransient
@@ -75,13 +77,13 @@ public class CamelExecutorServiceFactory
 
         ExecutorService answer;
         if (getPoolSize() == null || getPoolSize() <= 0) {
-            // use the cached thread pool
-            answer = camelContext.getExecutorServiceStrategy().newCachedThreadPool(getId(), name);
+            // use the default profile
+            answer = camelContext.getExecutorServiceStrategy().newDefaultThreadPool(getId(), name);
         } else {
             // use a custom pool based on the settings
             int max = getMaxPoolSize() != null ? getMaxPoolSize() : getPoolSize();
             answer = camelContext.getExecutorServiceStrategy()
-                        .newThreadPool(getId(), name, getPoolSize(), max, getKeepAliveTime(), getUnits(), isDeamon());
+                        .newThreadPool(getId(), name, getPoolSize(), max, getKeepAliveTime(), getUnits(), getMaxQueueSize(), isDaemon());
         }
         return answer;
     }
@@ -126,6 +128,14 @@ public class CamelExecutorServiceFactory
         this.units = units;
     }
 
+    public Integer getMaxQueueSize() {
+        return maxQueueSize;
+    }
+
+    public void setMaxQueueSize(Integer maxQueueSize) {
+        this.maxQueueSize = maxQueueSize;
+    }
+
     public String getThreadName() {
         return threadName;
     }
@@ -134,12 +144,12 @@ public class CamelExecutorServiceFactory
         this.threadName = threadName;
     }
 
-    public Boolean isDeamon() {
-        return deamon;
+    public Boolean isDaemon() {
+        return daemon;
     }
 
-    public void setDeamon(Boolean deamon) {
-        this.deamon = deamon;
+    public void setDaemon(Boolean daemon) {
+        this.daemon = daemon;
     }
 
     public String getCamelContextId() {