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 13:56:30 UTC

svn commit: r923718 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/spi/ camel-core/src/test/java/org/apache/camel/impl/ components/camel-spri...

Author: davsclaus
Date: Tue Mar 16 12:56:29 2010
New Revision: 923718

URL: http://svn.apache.org/viewvc?rev=923718&view=rev
Log:
CAMEL-1588: Configuring a custom default thread pool profile. Added better debug logging for thread pool activity.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java   (with props)
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.java
      - copied, changed from r923639, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml
      - copied, changed from r923639, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThreadPoolProfileSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.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/CamelThreadPoolFactoryBean.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=923718&r1=923717&r2=923718&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 12:56:29 2010
@@ -52,6 +52,8 @@ public class DefaultExecutorServiceStrat
     }
 
     public void setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile) {
+        LOG.info("Using custom DefaultThreadPoolProfile: " + defaultThreadPoolProfile);
+
         // the old is no longer default
         if (this.defaultThreadPoolProfile != null) {
             this.defaultThreadPoolProfile.setDefaultProfile(false);
@@ -81,41 +83,65 @@ public class DefaultExecutorServiceStrat
     }
 
     public ExecutorService newDefaultThreadPool(Object source, String name) {
-        ExecutorService answer = ExecutorServiceHelper.newThreadPool(threadNamePattern, name,
+        return newThreadPool(source, name,
             defaultThreadPoolProfile.getPoolSize(), defaultThreadPoolProfile.getMaxPoolSize(),
             defaultThreadPoolProfile.getKeepAliveTime(), defaultThreadPoolProfile.getTimeUnit(),
             defaultThreadPoolProfile.getMaxQueueSize(), defaultThreadPoolProfile.getRejectedExecutionHandler(), false);
-        onNewExecutorService(answer);
-        return answer;
     }
 
     public ExecutorService newCachedThreadPool(Object source, String name) {
         ExecutorService answer = ExecutorServiceHelper.newCachedThreadPool(threadNamePattern, name, true);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new cached thread pool for source: " + source + " with name: " + name + ". -> " + answer);
+        }
         return answer;
     }
 
     public ScheduledExecutorService newScheduledThreadPool(Object source, String name, int poolSize) {
         ScheduledExecutorService answer = ExecutorServiceHelper.newScheduledThreadPool(poolSize, threadNamePattern, name, true);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new scheduled thread pool for source: " + source + " with name: " + name + ". [poolSize=" + poolSize + "]. -> " + answer);
+        }
         return answer;
     }
 
     public ExecutorService newFixedThreadPool(Object source, String name, int poolSize) {
         ExecutorService answer = ExecutorServiceHelper.newFixedThreadPool(poolSize, threadNamePattern, name, true);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new fixed thread pool for source: " + source + " with name: " + name + ". [poolSize=" + poolSize + "]. -> " + answer);
+        }
         return answer;
     }
 
     public ExecutorService newSingleThreadExecutor(Object source, String name) {
         ExecutorService answer = ExecutorServiceHelper.newSingleThreadExecutor(threadNamePattern, name, true);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new single thread pool for source: " + source + " with name: " + name + ". -> " + answer);
+        }
         return answer;
     }
 
     public ExecutorService newThreadPool(Object source, String name, int corePoolSize, int maxPoolSize) {
         ExecutorService answer = ExecutorServiceHelper.newThreadPool(threadNamePattern, name, corePoolSize, maxPoolSize);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new thread pool for source: " + source + " with name: " + name + ". [poolSize=" + corePoolSize
+                    + ", maxPoolSize=" + maxPoolSize + "] -> " + answer);
+        }
         return answer;
     }
 
@@ -124,7 +150,15 @@ public class DefaultExecutorServiceStrat
                                          boolean daemon) {
         ExecutorService answer = ExecutorServiceHelper.newThreadPool(threadNamePattern, name, corePoolSize, maxPoolSize, keepAliveTime,
                                                                      timeUnit, maxQueueSize, rejectedExecutionHandler, daemon);
+        executorServices.add(answer);
         onNewExecutorService(answer);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Created new thread pool for source: " + source + " with name: " + name + ". [poolSize=" + corePoolSize
+                    + ", maxPoolSize=" + maxPoolSize + ", keepAliveTime=" + keepAliveTime + " " + timeUnit
+                    + ", maxQueueSize=" + maxQueueSize + ", rejectedExecutionHandler=" + rejectedExecutionHandler
+                    + ", daemon=" + daemon + "] -> " + answer);
+        }
         return answer;
     }
 
@@ -159,15 +193,12 @@ public class DefaultExecutorServiceStrat
     }
 
     /**
-     * Callback when a new {@link java.util.concurrent.ExecutorService} have been created.
+     * Strategy callback when a new {@link java.util.concurrent.ExecutorService} have been created.
      *
      * @param executorService the created {@link java.util.concurrent.ExecutorService} 
      */
     protected void onNewExecutorService(ExecutorService executorService) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Created new ExecutorService: " + executorService);
-        }
-        executorServices.add(executorService);
+        // noop
     }
 
     @Override

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java?rev=923718&r1=923717&r2=923718&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java Tue Mar 16 12:56:29 2010
@@ -245,10 +245,14 @@ public class DefaultShutdownStrategy ext
 
     @Override
     protected void doStop() throws Exception {
+        // noop
+    }
+
+    @Override
+    protected void doShutdown() throws Exception {
         if (executor != null) {
-            executor.shutdownNow();
+            camelContext.getExecutorServiceStrategy().shutdownNow(executor);
         }
-        executor = null;
     }
 
     class ShutdownDeferredConsumer {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThreadPoolProfileSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThreadPoolProfileSupport.java?rev=923718&r1=923717&r2=923718&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThreadPoolProfileSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThreadPoolProfileSupport.java Tue Mar 16 12:56:29 2010
@@ -36,7 +36,7 @@ public class ThreadPoolProfileSupport im
     private ThreadPoolRejectedPolicy rejectedPolicy;
 
     public Boolean isDefaultProfile() {
-        return defaultProfile;
+        return defaultProfile != null && defaultProfile;
     }
 
     public void setDefaultProfile(Boolean defaultProfile) {
@@ -97,4 +97,10 @@ public class ThreadPoolProfileSupport im
     public void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy) {
         this.rejectedPolicy = rejectedPolicy;
     }
+
+    @Override
+    public String toString() {
+        return "ThreadPoolProfile[" + defaultProfile + ", " + poolSize + ", " + maxPoolSize + ", " + keepAliveTime
+                + " " + timeUnit + ", " + maxPoolSize + ", " + rejectedPolicy + "]";
+    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java?rev=923718&r1=923717&r2=923718&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java Tue Mar 16 12:56:29 2010
@@ -96,7 +96,7 @@ public class ThreadPoolProfileDefinition
     }
 
     public Boolean isDefaultProfile() {
-        return defaultProfile;
+        return defaultProfile != null && defaultProfile;
     }
 
     public void setDefaultProfile(Boolean defaultProfile) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java?rev=923718&r1=923717&r2=923718&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ThreadPoolProfile.java Tue Mar 16 12:56:29 2010
@@ -137,6 +137,4 @@ public interface ThreadPoolProfile {
      */
     void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy);
 
-
-
 }

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java?rev=923718&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java Tue Mar 16 12:56:29 2010
@@ -0,0 +1,65 @@
+/**
+ * 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.impl;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.ThreadPoolRejectedPolicy;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.ThreadPoolProfile;
+
+/**
+ * @version $Revision$
+ */
+public class CamelCustomDefaultThreadPoolProfileTest extends ContextTestSupport {
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camel = super.createCamelContext();
+
+        ThreadPoolProfile profile = new ThreadPoolProfileSupport();
+        profile.setPoolSize(5);
+        profile.setMaxPoolSize(15);
+        profile.setKeepAliveTime(25L);
+        profile.setMaxQueueSize(250);
+        profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);
+
+        camel.getExecutorServiceStrategy().setDefaultThreadPoolProfile(profile);
+        return camel;
+    }
+
+    public void testCamelCustomDefaultThreadPoolProfile() throws Exception {
+        ThreadPoolProfile profile = context.getExecutorServiceStrategy().getDefaultThreadPoolProfile();
+        assertEquals(5, profile.getPoolSize().intValue());
+        assertEquals(15, profile.getMaxPoolSize().intValue());
+        assertEquals(25, profile.getKeepAliveTime().longValue());
+        assertEquals(250, profile.getMaxQueueSize().intValue());
+        assertEquals(ThreadPoolRejectedPolicy.Abort, profile.getRejectedPolicy());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .threads()
+                    .to("mock:result");
+            }
+        };
+    }
+}

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/CamelCustomDefaultThreadPoolProfileTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=923718&r1=923717&r2=923718&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 Tue Mar 16 12:56:29 2010
@@ -17,8 +17,10 @@
 package org.apache.camel.spring;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -73,6 +75,7 @@ import org.apache.camel.spi.ManagementSt
 import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.spi.ShutdownStrategy;
+import org.apache.camel.spi.ThreadPoolProfile;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -314,6 +317,25 @@ public class CamelContextFactoryBean ext
             }
         }
 
+        // set the default thread pool profile if defined
+        Map<String, ThreadPoolProfile> threadPoolProfiles = getContext().getRegistry().lookupByType(ThreadPoolProfile.class);
+        if (threadPoolProfiles != null && !threadPoolProfiles.isEmpty()) {
+            Set<String> ids = new HashSet<String>();
+            for (String id : threadPoolProfiles.keySet()) {
+                ThreadPoolProfile profile = threadPoolProfiles.get(id);
+                // do not add if already added, for instance a tracer that is also an InterceptStrategy class
+                if (profile.isDefaultProfile()) {
+                    LOG.info("Using custom default ThreadPoolProfile with id: " + id + " and implementation: " + profile);
+                    getContext().getExecutorServiceStrategy().setDefaultThreadPoolProfile(profile);
+                    ids.add(id);
+                }
+            }
+            // validate at most one is defined
+            if (ids.size() > 1) {
+                throw new IllegalArgumentException("Only exactly one default ThreadPoolProfile is allowed, was " + ids.size() + " ids: " + ids);
+            }
+        }
+
         // Set the application context and camelContext for the beanPostProcessor
         if (beanPostProcessor != null) {
             if (beanPostProcessor instanceof ApplicationContextAware) {

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java?rev=923718&r1=923717&r2=923718&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java Tue Mar 16 12:56:29 2010
@@ -52,7 +52,7 @@ public class CamelThreadPoolFactoryBean 
     @XmlAttribute
     private Integer maxPoolSize;
     @XmlAttribute
-    private Integer keepAliveTime = 60;
+    private Long keepAliveTime = 60L;
     @XmlAttribute
     @XmlJavaTypeAdapter(TimeUnitAdapter.class)
     private TimeUnit units = TimeUnit.SECONDS;
@@ -120,11 +120,11 @@ public class CamelThreadPoolFactoryBean 
         this.maxPoolSize = maxPoolSize;
     }
 
-    public Integer getKeepAliveTime() {
+    public Long getKeepAliveTime() {
         return keepAliveTime;
     }
 
-    public void setKeepAliveTime(Integer keepAliveTime) {
+    public void setKeepAliveTime(Long keepAliveTime) {
         this.keepAliveTime = keepAliveTime;
     }
 

Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.java (from r923639, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java&r1=923639&r2=923718&rev=923718&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.java Tue Mar 16 12:56:29 2010
@@ -16,38 +16,28 @@
  */
 package org.apache.camel.spring.config;
 
-import java.util.List;
-
 import org.apache.camel.CamelContext;
-import org.apache.camel.Channel;
-import org.apache.camel.Route;
-import org.apache.camel.impl.EventDrivenConsumerRoute;
-import org.apache.camel.processor.DeadLetterChannel;
-import org.apache.camel.processor.RedeliveryPolicy;
+import org.apache.camel.ThreadPoolRejectedPolicy;
+import org.apache.camel.spi.ThreadPoolProfile;
 import org.apache.camel.spring.SpringTestSupport;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class ErrorHandlerTest extends SpringTestSupport {
+public class SpringCamelContextCustomDefaultThreadPoolProfileTest extends SpringTestSupport {
 
     protected AbstractXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/errorHandler.xml");
+        return new ClassPathXmlApplicationContext("org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml");
     }
 
-    public void testEndpointConfiguration() throws Exception {
+    public void testDefaultThreadPoolProfile() throws Exception {
         CamelContext context = getMandatoryBean(CamelContext.class, "camel");
-        List<Route> list = context.getRoutes();
-        assertEquals("Number routes created" + list, 2, list.size());
-        for (Route route : list) {
-            EventDrivenConsumerRoute consumerRoute = assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
-            Channel channel = unwrapChannel(consumerRoute.getProcessor());
-
-            DeadLetterChannel deadLetterChannel = assertIsInstanceOf(DeadLetterChannel.class, channel.getErrorHandler());
-            RedeliveryPolicy redeliveryPolicy = deadLetterChannel.getRedeliveryPolicy();
-
-            assertEquals("getMaximumRedeliveries()", 1, redeliveryPolicy.getMaximumRedeliveries());
-            assertEquals("isUseExponentialBackOff()", true, redeliveryPolicy.isUseExponentialBackOff());
-        }
+
+        ThreadPoolProfile profile = context.getExecutorServiceStrategy().getDefaultThreadPoolProfile();
+        assertEquals(5, profile.getPoolSize().intValue());
+        assertEquals(15, profile.getMaxPoolSize().intValue());
+        assertEquals(25, profile.getKeepAliveTime().longValue());
+        assertEquals(250, profile.getMaxQueueSize().intValue());
+        assertEquals(ThreadPoolRejectedPolicy.Abort, profile.getRejectedPolicy());
     }
 
-}
+}
\ No newline at end of file

Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml (from r923639, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml&r1=923639&r2=923718&rev=923718&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/SpringCamelContextCustomDefaultThreadPoolProfileTest.xml Tue Mar 16 12:56:29 2010
@@ -22,28 +22,22 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
+    <!-- define the default thread profile settings -->
+    <bean id="myDefaultThreadPoolProfile" class="org.apache.camel.impl.ThreadPoolProfileSupport">
+        <property name="defaultProfile" value="true"/>
+        <property name="poolSize" value="5"/>
+        <property name="maxPoolSize" value="15"/>
+        <property name="keepAliveTime" value="25"/>
+        <property name="maxQueueSize" value="250"/>
+        <property name="rejectedPolicy" value="Abort"/>
+    </bean>
 
-    <camelContext id="camel" errorHandlerRef="deadLetterErrorHandler" xmlns="http://camel.apache.org/schema/spring">
-        <jmxAgent id="agent" disabled="true"/>
-        <route>
-            <from uri="seda:a"/>
-            <to uri="seda:b"/>
-        </route>
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
-            <from uri="direct:c"/>
-            <to uri="direct:d"/>
+            <from uri="direct:start"/>
+            <threads/>
+            <to uri="mock:result"/>
         </route>
     </camelContext>
 
-    <bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
-        <property name="deadLetterUri" value="bean:exceptionProcessor"/>
-        <property name="redeliveryPolicy" ref="rsRedeliveryPolicyConfig"/>
-    </bean>
-
-    <bean id="rsRedeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
-        <property name="maximumRedeliveries" value="1"/>
-        <property name="redeliverDelay" value="30000"/>
-        <property name="useExponentialBackOff" value="true"/>
-    </bean>
-
 </beans>