camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Camel > Threading Model
Date Sun, 21 Mar 2010 13:33:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="">Threading
     <h4>Page <b>edited</b> by             <a href="">Claus
     <div class="notificationGreySide">
         <h2><a name="ThreadingModel-ThreadingModel"></a>Threading Model</h2>
<p><b>This information applies from Camel 2.3 onwards</b></p>

<p>The threading model in Camel is based on leveraging the JDK concurrency API which
provides thread pools, named <tt>ExecutorService</tt>.</p>

<p>Camel leverages thread pools in the following places:</p>
<ul class="alternate" type="square">
	<li>several <a href="/confluence/display/CAMEL/EIP" title="EIP">EIP</a>
patterns supports using thread pools for concurrency</li>
	<li><a href="/confluence/display/CAMEL/SEDA" title="SEDA">SEDA</a> component
for asynchronous connectivity</li>
	<li><a href="/confluence/display/CAMEL/Async" title="Async">Threads DSL</a>
in the Camel route</li>
	<li><a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=ServicePools&amp;linkCreation=true&amp;fromPageId=14813422"
class="createlink">ServicePools</a> for pooling services</li>
	<li>And some component provide thread pools by nature such as <a href="/confluence/display/CAMEL/JMS"
title="JMS">JMS</a>, <a href="/confluence/display/CAMEL/Jetty" title="Jetty">Jetty</a></li>

<h3><a name="ThreadingModel-Threadpoolprofiles"></a>Thread pool profiles</h3>
<p>By default when a thread pool is to be created then its based on the default thread
pool profile which is:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
    &lt;threadPoolProfile id=<span class="code-quote">"defaultThreadPoolProfile"</span>
defaultProfile=<span class="code-quote">"true"</span>
                       poolSize=<span class="code-quote">"10"</span> maxPoolSize=<span
class="code-quote">"20"</span> maxQueueSize=<span class="code-quote">"1000"</span>
                       rejectedPolicy=<span class="code-quote">"CallerRuns"</span>/&gt;

<p>What that means is that for example when you use <a href="/confluence/display/CAMEL/Multicast"
title="Multicast">Multicast</a> with <tt>parallelProcessing=true</tt>
enabled, then it would create a thread pool based on the profile above. The <tt>rejectedPolicy</tt>
have four options: <tt>Abort, CallerRuns, Discard, DiscardOldest</tt> which corresponds
to the same four options provided out of the box in the JDK. </p>

<p>In Java DSL you can configure the default thread pool profile from the <tt>ExecutorServiceStartegy</tt>
which you access from <tt>CamelContext</tt>.</p>

<h3><a name="ThreadingModel-Management"></a>Management</h3>
<p>All the thread pools that Camel creates are managed and thus you can see them in
JConsole under the <tt>threadpools</tt> category.</p>

<h3><a name="ThreadingModel-ExecutorServiceStrategy"></a>ExecutorServiceStrategy</h3>
<p>Camel provides a pluggable strategy to hook in your own thread pool provider, for
example from a WorkManager in a J2EE server etc.<br/>
See the <tt>org.apache.camel.spi.ExecutorServiceStrategy</tt> interface which
you should implement and hook into the WorkManager.</p>

<p>See [Advanced XXX config}} for how to configure it.</p>

<p>You can configure it on the <tt>CamelContext</tt> from Java DSL using
the getter/setter.</p>

<h3><a name="ThreadingModel-SeeAlso"></a>See Also</h3>
<ul class="alternate" type="square">
	<li><a href="/confluence/display/CAMEL/Architecture" title="Architecture">Architecture</a></li>
	<li><a href="/confluence/display/CAMEL/Async" title="Async">Async</a></li>

     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>

       <a href="">View
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message