Author: chirino
Date: Fri Sep 22 10:21:03 2006
New Revision: 449012
URL: http://svn.apache.org/viewvc?view=rev&rev=449012
Log:
Latest export from confluence
Modified:
incubator/servicemix/site/main/thread-pools.html
Modified: incubator/servicemix/site/main/thread-pools.html
URL:
http://svn.apache.org/viewvc/incubator/servicemix/site/main/thread-pools.html?view=diff&rev=449012&r1=449011&r2=449012
==============================================================================
--- incubator/servicemix/site/main/thread-pools.html (original)
+++ incubator/servicemix/site/main/thread-pools.html Fri Sep 22 10:21:03 2006
@@ -164,7 +164,71 @@
</TR>
</TBODY></TABLE>
-<P>You will find a more detailed explanation of these parameters from the
<SPAN class="nobr"><A
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html"
title="Visit page outside Confluence"
rel="nofollow">ThreadPoolExecutor<SUP><IMG class="rendericon"
src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0"
width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN>.</P></DIV>
+<P>Each thread pool has its own identifier, for example:</P>
+<UL>
+ <LI><TT>component.id</TT> where <TT>id</TT> is the name of the
component</LI>
+ <LI><TT>flow.seda.id</TT> where <TT>id</TT> is the name of the
component</LI>
+ <LI><TT>flow.jca.destination</TT> where <TT>destination</TT> is the
name of the JMS destination used</LI>
+</UL>
+
+
+<P>Thread pools are configured hierarchically using these ids. It means that
when an executor is created with an id of <code>foo.bar</code>, the
factory will look for a configuration in the following way:</P>
+<UL>
+ <LI><TT>configs.get("foo.bar")</TT></LI>
+ <LI><TT>configs.get("foo")</TT></LI>
+ <LI><TT>defaultConfig</TT></LI>
+</UL>
+
+
+<P>Following is an example configuration of the factory:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag"><sm:container ...></SPAN>
+ <SPAN class="code-tag"><sm:executorFactory></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.executors.impl.ExecutorFactoryImpl"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"defaultConfig"</SPAN>></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.executors.impl.ExecutorConfig"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"corePoolSize"</SPAN> value=<SPAN
class="code-quote">"4"</SPAN>/></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"maximumPoolSize"</SPAN> value=<SPAN
class="code-quote">"-1"</SPAN>/></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"queueSize"</SPAN> value=<SPAN
class="code-quote">"0"</SPAN>/></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></property></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"configs"</SPAN>></SPAN>
+ <SPAN class="code-tag"><map></SPAN>
+ <SPAN class="code-tag"><entry key=<SPAN
class="code-quote">"flow.seda"</SPAN>></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.executors.impl.ExecutorConfig"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"corePoolSize"</SPAN> value=<SPAN
class="code-quote">"32"</SPAN>/></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"maximumPoolSize"</SPAN> value=<SPAN
class="code-quote">"-1"</SPAN>/></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"queueSize"</SPAN> value=<SPAN
class="code-quote">"1024"</SPAN>/></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></entry></SPAN>
+ <SPAN class="code-tag"></map></SPAN>
+ <SPAN class="code-tag"></property></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></sm:executorFactory></SPAN>
+ ...
+<SPAN class="code-tag"></sm:container></SPAN></PRE>
+</DIV></DIV>
+
+
+<P>Usually, three parameters will be used to configure the behavior of the
thread pool:</P>
+<UL>
+ <LI><TT>corePoolSize</TT></LI>
+ <LI><TT>maximumPoolSize</TT></LI>
+ <LI><TT>queueSize</TT></LI>
+</UL>
+
+
+<P>When the executor receives a new task, the following happen:</P>
+<UL>
+ <LI>if the number of threads is less than <TT>corePoolSize</TT>, the
executor will create a new thread to handle the job</LI>
+ <LI>if the number of queued jobs is less than <TT>queueSize</TT>, the
job is queued</LI>
+ <LI>is the queue is full and the number of threads is less than
<TT>maximumPoolSize</TT>, a new thread is created to handle the job</LI>
+ <LI>else, the current thread will handle the job</LI>
+</UL>
+
+
+<P>Note that <TT>maximumPoolSize</TT> and <TT>queueSize</TT> can be set to -1
to not bound these values.</P></DIV>
</DIV>
</TD>
@@ -175,7 +239,8 @@
<DIV id="site-footer">
Added by <A
href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume
Nodet</A>,
last edited by <A
href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume
Nodet</A> on Sep 22, 2006
-
+ (<A
href="http://goopen.org/confluence/pages/diffpages.action?pageId=13790&originalId=13791">view
change</A>)
+
(<A
href="http://goopen.org/confluence/pages/editpage.action?pageId=13790">edit
page</A>)
</DIV>