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/05 14:42:36 UTC

svn commit: r919408 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/test/java/org/apache/camel/processor/ components/camel-spring/src/main/java/org/apache/camel/spring/ components/camel-spring/src/main/java/org/apache...

Author: davsclaus
Date: Fri Mar  5 13:42:35 2010
New Revision: 919408

URL: http://svn.apache.org/viewvc?rev=919408&view=rev
Log:
CAMEL-1588: Added threadPool to Spring XML to easily define pools which can be leveraged in the Camel routes.

Added:
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java
      - copied, changed from r919387, camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java   (with props)
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsThreadPoolFactoryBeanTest.java
      - copied, changed from r919389, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsDefaultTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml   (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml
      - copied, changed from r919389, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsCoreAndMaxPoolTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsDefaultTest.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
    camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index
    camel/trunk/components/camel-spring/src/test/resources/log4j.properties
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolKeepAliveTimeTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCorePoolTest.xml
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java Fri Mar  5 13:42:35 2010
@@ -56,6 +56,8 @@
     @XmlJavaTypeAdapter(TimeUnitAdapter.class)
     private TimeUnit units = TimeUnit.SECONDS;
     @XmlAttribute(required = false)
+    private String threadName;
+    @XmlAttribute(required = false)
     private WaitForTaskToComplete waitForTaskToComplete = WaitForTaskToComplete.IfReplyExpected;
 
     @Override
@@ -66,14 +68,16 @@
                 throw new IllegalArgumentException("ExecutorServiceRef " + executorServiceRef + " not found in registry.");
             }
         }
+
         if (executorService == null) {
+            String name = getThreadName() != null ? getThreadName() : "Threads";
             if (poolSize == null || poolSize <= 0) {
                 // use the cached thread pool
-                executorService = ExecutorServiceHelper.newCachedThreadPool("Threads", true);
+                executorService = ExecutorServiceHelper.newCachedThreadPool(name, true);
             } else {
                 // use a custom pool based on the settings
                 int max = getMaxPoolSize() != null ? getMaxPoolSize() : poolSize;
-                executorService = ExecutorServiceHelper.newThreadPool("Threads", poolSize, max, getKeepAliveTime(), getUnits(), true);
+                executorService = ExecutorServiceHelper.newThreadPool(name, poolSize, max, getKeepAliveTime(), getUnits(), true);
             }
         }
         Processor childProcessor = routeContext.createProcessor(this);
@@ -157,6 +161,17 @@
     }
 
     /**
+     * Sets the thread name to use.
+     *
+     * @param threadName the thread name
+     * @return the builder
+     */
+    public ThreadsDefinition threadName(String threadName) {
+        setThreadName(threadName);
+        return this;
+    }
+
+    /**
      * Setting to whether to wait for async tasks to be complete before continuing original route.
      * <p/>
      * Is default <tt>IfReplyExpected</tt>
@@ -224,4 +239,12 @@
     public void setUnits(TimeUnit units) {
         this.units = units;
     }
+
+    public String getThreadName() {
+        return threadName;
+    }
+
+    public void setThreadName(String threadName) {
+        this.threadName = threadName;
+    }
 }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsCoreAndMaxPoolTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsCoreAndMaxPoolTest.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsCoreAndMaxPoolTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsCoreAndMaxPoolTest.java Fri Mar  5 13:42:35 2010
@@ -52,7 +52,7 @@
 
                 from("direct:foo")
                     // using the builder style
-                    .threads().poolSize(5).maxPoolSize(10)
+                    .threads().poolSize(5).maxPoolSize(10).threadName("myPool")
                     .to("mock:result");
             }
         };

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsDefaultTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsDefaultTest.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsDefaultTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThreadsDefaultTest.java Fri Mar  5 13:42:35 2010
@@ -25,7 +25,7 @@
 public class ThreadsDefaultTest extends ContextTestSupport {
 
     public void testThreadsDefault() throws Exception {
-        getMockEndpoint("mock:result").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
 
         template.sendBody("direct:start", "Hello World");
 
@@ -40,6 +40,7 @@
                 from("direct:start")
                     // will use a cached thread pool which can grown/shrink
                     .threads()
+                    .to("log:foo")
                     .to("mock:result");
             }
         };

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Fri Mar  5 13:42:35 2010
@@ -137,6 +137,8 @@
     private List beans;    
     @XmlElement(name = "routeBuilder", required = false)
     private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
+    @XmlElement(name = "threadPool", required = false)
+    private List<CamelExecutorServiceFactoryBean> threadPools;
     @XmlElement(name = "endpoint", required = false)
     private List<CamelEndpointFactoryBean> endpoints;
     @XmlElement(name = "dataFormats", required = false)

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java Fri Mar  5 13:42:35 2010
@@ -56,7 +56,6 @@
     private Endpoint endpoint;
     @XmlTransient
     private ApplicationContext applicationContext;
-   
 
     public Object getObject() throws Exception {
         if (endpoint == null) {

Copied: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java (from r919387, camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java?p2=camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java&p1=camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java&r1=919387&r2=919408&rev=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelExecutorServiceFactoryBean.java Fri Mar  5 13:42:35 2010
@@ -16,114 +16,110 @@
  */
 package org.apache.camel.spring;
 
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Endpoint;
-import org.apache.camel.NoSuchEndpointException;
-import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.builder.xml.TimeUnitAdapter;
 import org.apache.camel.model.IdentifiedType;
-import org.apache.camel.spring.util.CamelContextResolverHelper;
-import org.springframework.beans.BeansException;
+import org.apache.camel.util.concurrent.ExecutorServiceHelper;
 import org.springframework.beans.factory.FactoryBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-import static org.apache.camel.util.ObjectHelper.notNull;
 
 /**
- * A {@link FactoryBean} which instantiates {@link Endpoint} objects
+ * A {@link org.springframework.beans.factory.FactoryBean} which instantiates {@link java.util.concurrent.ExecutorService} objects
  *
  * @version $Revision$
  */
-@XmlRootElement(name = "endpoint")
+@XmlRootElement(name = "threadPool")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CamelEndpointFactoryBean extends IdentifiedType implements FactoryBean, CamelContextAware, ApplicationContextAware {
-    @XmlAttribute    
-    private Boolean singleton = Boolean.FALSE;
-    @XmlAttribute
-    private String uri;
+public class CamelExecutorServiceFactoryBean extends IdentifiedType implements FactoryBean {
+
+    @XmlAttribute(required = false)
+    private Integer poolSize;
+    @XmlAttribute(required = false)
+    private Integer maxPoolSize;
+    @XmlAttribute(required = false)
+    private Integer keepAliveTime = 60;
+    @XmlAttribute(required = false)
+    @XmlJavaTypeAdapter(TimeUnitAdapter.class)
+    private TimeUnit units = TimeUnit.SECONDS;
+    @XmlAttribute(required = false)
+    private String threadName;
     @XmlAttribute
-    private String camelContextId;
-    @XmlTransient
-    private CamelContext context;    
-    @XmlTransient
-    private Endpoint endpoint;
-    @XmlTransient
-    private ApplicationContext applicationContext;
-   
+    private Boolean deamon = Boolean.TRUE;
 
     public Object getObject() throws Exception {
-        if (endpoint == null) {
-            endpoint = createEndpoint();
+        String name = getThreadName() != null ? getThreadName() : getId();
+
+        ExecutorService answer;
+        if (getPoolSize() == null || getPoolSize() <= 0) {
+            // use the cached thread pool
+            answer = ExecutorServiceHelper.newCachedThreadPool(name, isDeamon());
+        } else {
+            // use a custom pool based on the settings
+            int max = getMaxPoolSize() != null ? getMaxPoolSize() : getPoolSize();
+            answer = ExecutorServiceHelper.newThreadPool(name, getPoolSize(), max, getKeepAliveTime(), getUnits(), isDeamon());
         }
-        return endpoint;
+        return answer;
     }
 
     public Class getObjectType() {
-        return Endpoint.class;
+        return ExecutorService.class;
     }
-    
+
     public boolean isSingleton() {
-        return singleton;
+        return true;
     }
-    
-    public void setSingleton(boolean singleton) {
-        this.singleton = singleton;
+
+    public Integer getPoolSize() {
+        return poolSize;
     }
 
-    public CamelContext getCamelContext() {
-        return context;
+    public void setPoolSize(Integer poolSize) {
+        this.poolSize = poolSize;
     }
-    
 
-    /**
-     * Sets the context to use to resolve endpoints
-     *
-     * @param context the context used to resolve endpoints
-     */
-    public void setCamelContext(CamelContext context) {
-        this.context = context;
+    public Integer getMaxPoolSize() {
+        return maxPoolSize;
     }
 
-    public String getUri() {
-        return uri;
+    public void setMaxPoolSize(Integer maxPoolSize) {
+        this.maxPoolSize = maxPoolSize;
     }
 
-    /**
-     * Sets the URI to use to resolve the endpoint
-     *
-     * @param uri the URI used to set the endpoint
-     */
-    public void setUri(String uri) {
-        this.uri = uri;
+    public Integer getKeepAliveTime() {
+        return keepAliveTime;
     }
 
-    protected Endpoint createEndpoint() {
-        if (context == null && camelContextId != null) {
-            context = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId);
-        }
-        notNull(context, "context");
-        notNull(uri, "uri");
-        
-        Endpoint endpoint = context.getEndpoint(uri);
-        if (endpoint == null) {
-            throw new NoSuchEndpointException(uri);
-        }
-        return endpoint;
+    public void setKeepAliveTime(Integer keepAliveTime) {
+        this.keepAliveTime = keepAliveTime;
+    }
+
+    public TimeUnit getUnits() {
+        return units;
+    }
+
+    public void setUnits(TimeUnit units) {
+        this.units = units;
+    }
+
+    public String getThreadName() {
+        return threadName;
+    }
+
+    public void setThreadName(String threadName) {
+        this.threadName = threadName;
     }
 
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        this.applicationContext = applicationContext;
+    public Boolean isDeamon() {
+        return deamon;
     }
 
-    public void setCamelContextId(String camelContextId) {
-        this.camelContextId = camelContextId;
+    public void setDeamon(Boolean deamon) {
+        this.deamon = deamon;
     }
-   
-}
+}
\ No newline at end of file

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java Fri Mar  5 13:42:35 2010
@@ -26,6 +26,7 @@
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 
+import org.apache.camel.spring.CamelExecutorServiceFactoryBean;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -94,6 +95,7 @@
         addBeanDefinitionParser("consumerTemplate", CamelConsumerTemplateFactoryBean.class, true);
         addBeanDefinitionParser("export", CamelServiceExporter.class, true);
         addBeanDefinitionParser("endpoint", CamelEndpointFactoryBean.class, true);
+        addBeanDefinitionParser("threadPool", CamelExecutorServiceFactoryBean.class, true);
 
         // jmx agent and property placeholder cannot be used outside of the camel context
         addBeanDefinitionParser("jmxAgent", CamelJMXAgentDefinition.class, false);

Modified: camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index (original)
+++ camel/trunk/components/camel-spring/src/main/resources/org/apache/camel/spring/jaxb.index Fri Mar  5 13:42:35 2010
@@ -18,6 +18,7 @@
 CamelConsumerTemplateFactoryBean
 CamelContextFactoryBean
 CamelEndpointFactoryBean
+CamelExecutorServiceFactoryBean
 CamelJMXAgentDefinition
 CamelProducerTemplateFactoryBean
 CamelPropertyPlaceholderDefinition

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java?rev=919408&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java Fri Mar  5 13:42:35 2010
@@ -0,0 +1,30 @@
+/**
+ * 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.spring.processor;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.processor.ThreadsDefaultTest;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringThreadsExternalThreadPoolFactoryBeanTest extends ThreadsDefaultTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml");
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsExternalThreadPoolFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsThreadPoolFactoryBeanTest.java (from r919389, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsDefaultTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsThreadPoolFactoryBeanTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsThreadPoolFactoryBeanTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsDefaultTest.java&r1=919389&r2=919408&rev=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsDefaultTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThreadsThreadPoolFactoryBeanTest.java Fri Mar  5 13:42:35 2010
@@ -21,10 +21,10 @@
 
 import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
-public class SpringThreadsDefaultTest extends ThreadsDefaultTest {
+public class SpringThreadsThreadPoolFactoryBeanTest extends ThreadsDefaultTest {
 
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ThreadsDefaultTest.xml");
+        return createSpringCamelContext(this, "org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml");
     }
 
 }
\ No newline at end of file

Modified: camel/trunk/components/camel-spring/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/log4j.properties?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-spring/src/test/resources/log4j.properties Fri Mar  5 13:42:35 2010
@@ -18,7 +18,7 @@
 #
 # The logging properties used for eclipse testing, We want to see debug output on the console.
 #
-log4j.rootLogger=WARN, file
+log4j.rootLogger=INFO, out
 
 log4j.logger.org.springframework=WARN
 log4j.logger.org.apache.camel.impl.converter=WARN

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolKeepAliveTimeTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolKeepAliveTimeTest.xml?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolKeepAliveTimeTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolKeepAliveTimeTest.xml Fri Mar  5 13:42:35 2010
@@ -25,8 +25,9 @@
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="direct:start"/>
-            <threads poolSize="5" maxPoolSize="10" keepAliveTime="10" units="SECONDS"/>
-            <to uri="mock:result"/>
+            <threads poolSize="5" maxPoolSize="10" keepAliveTime="10" units="SECONDS">
+                <to uri="mock:result"/>
+            </threads>
         </route>
     </camelContext>
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolTest.xml?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCoreAndMaxPoolTest.xml Fri Mar  5 13:42:35 2010
@@ -26,8 +26,9 @@
         <route>
             <from uri="direct:start"/>
             <from uri="direct:foo"/>
-            <threads poolSize="5" maxPoolSize="10"/>
-            <to uri="mock:result"/>
+            <threads poolSize="5" maxPoolSize="10">
+                <to uri="mock:result"/>
+            </threads>
         </route>
     </camelContext>
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCorePoolTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCorePoolTest.xml?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCorePoolTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsCorePoolTest.xml Fri Mar  5 13:42:35 2010
@@ -26,8 +26,9 @@
         <route>
             <from uri="direct:start"/>
             <from uri="direct:foo"/>
-            <threads poolSize="5"/>
-            <to uri="mock:result"/>
+            <threads poolSize="5">
+                <to uri="mock:result"/>
+            </threads>
         </route>
     </camelContext>
 </beans>

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml?rev=919408&r1=919407&r2=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml Fri Mar  5 13:42:35 2010
@@ -25,8 +25,10 @@
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="direct:start"/>
-            <threads/>
-            <to uri="mock:result"/>
+            <threads>
+                <to uri="log:foo"/>
+                <to uri="mock:result"/>
+            </threads>
         </route>
     </camelContext>
 </beans>

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml?rev=919408&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml Fri Mar  5 13:42:35 2010
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <!-- START SNIPPET: e1 -->
+    <!-- define a custom thread pool -->
+    <threadPool id="myPool"
+                poolSize="2"
+                maxPoolSize="4"
+                threadName="myPool"
+                keepAliveTime="30"
+                units="SECONDS"
+                deamon="true"
+                xmlns="http://camel.apache.org/schema/spring"/>
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+        <route>
+            <from uri="direct:start"/>
+            <!-- use the custom thread pool in the camel route -->
+            <threads executorServiceRef="myPool">
+                <to uri="mock:result"/>
+            </threads>
+        </route>
+        
+    </camelContext>
+    <!-- END SNIPPET: e1 -->
+
+</beans>

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsExternalThreadPoolFactoryBeanTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml (from r919389, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml&r1=919389&r2=919408&rev=919408&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsDefaultTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThreadsThreadPoolFactoryBeanTest.xml Fri Mar  5 13:42:35 2010
@@ -22,11 +22,21 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
+    <!-- START SNIPPET: e1 -->
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+
+        <!-- define a custom thread pool -->
+        <threadPool id="myPool" poolSize="2" maxPoolSize="4" threadName="myPool"/>
+
         <route>
             <from uri="direct:start"/>
-            <threads/>
-            <to uri="mock:result"/>
+            <!-- use the custom thread pool in the camel route -->
+            <threads executorServiceRef="myOtherPool">
+                <to uri="mock:result"/>
+            </threads>
         </route>
+        
     </camelContext>
+    <!-- END SNIPPET: e1 -->
+
 </beans>