blob: 5a51f08d7467a4effcd47276bf8799c807803da5 [file] [log] [blame]
Hongqing Liufd5ee812014-05-10 16:32:51 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference (6.0.39) - The Executor (thread pool)</title><meta name="author" content="Filip Hanik"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4 </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="../images/tomcat.gif" align="right" alt="
5 The Apache Tomcat Servlet/JSP Container
6 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 6.0</font></h1><font face="arial,helvetica,sanserif">Version 6.0.39, Jan 27 2014</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="../images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap="nowrap" class="noPrint"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li></ul><p><strong>Top Level Elements</strong></p><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul><p><strong>Executors</strong></p><ul><li><a href="executor.html">Executor</a></li></ul><p><strong>Connectors</strong></p><ul><li><a href="http.html">HTTP</a></li><li><a href="ajp.html">AJP</a></li></ul><p><strong>Containers</strong></p><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul><p><strong>Nested Components</strong></p><ul><li><a href="globalresources.html">Global Resources</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="valve.html">Valve</a></li></ul><p><strong>Cluster Elements</strong></p><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul><p><strong>Other</strong></p><ul><li><a href="filter.html">Filter</a></li><li><a href="systemprops.html">System properties</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Apache Tomcat Configuration Reference</h1><h2>The Executor (thread pool)</h2><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
7<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#Common_Attributes">Common Attributes</a></li><li><a href="#Standard_Implementation">Standard Implementation</a></li></ol></li></ul>
8</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
9
10 <p>The <strong>Executor</strong> represents a thread pool that can be shared
11 between components in Tomcat. Historically there has been a thread pool per
12 connector created but this allows you to share a thread pool, between (primarly) connector
13 but also other components when those get configured to support executors</p>
14
15
16 <p>The executor has to implement the <code>org.apache.catalina.Executor</code> interface.</p>
17
18 <p>The executor is a nested element to the <a href="service.html">Service</a> element.
19 And in order for it to be picked up by the connectors, the Executor element has to appear
20 prior to the Connector element in server.xml</p>
21</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote>
22
23 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Common Attributes"><!--()--></a><a name="Common_Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote>
24
25 <p>All implementations of <strong>Executor</strong>
26 support the following attributes:</p>
27
28 <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><code>className</code></td><td align="left" valign="center">
29 <p>The class of the implementation. The implementation has to implement the
30 <code>org.apache.catalina.Executor</code> interface.
31 This interface ensures that the object can be referenced through its <code>name</code> attribute
32 and that implements Lifecycle, so that it can be started and stopped with the container.
33 The default value for the className is <code>org.apache.catalina.core.StandardThreadExecutor</code></p>
34 </td></tr><tr><td align="left" valign="center"><strong><code>name</code></strong></td><td align="left" valign="center">
35 <p>The name used to reference this pool in other places in server.xml.
36 The name is required and must be unique.</p>
37 </td></tr></table>
38
39 </blockquote></td></tr></table>
40
41 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Standard Implementation"><!--()--></a><a name="Standard_Implementation"><strong>Standard Implementation</strong></a></font></td></tr><tr><td><blockquote>
42
43 <p>
44 The default implementation supports the following attributes:</p>
45
46 <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><code>threadPriority</code></td><td align="left" valign="center">
47 <p>(int) The thread priority for threads in the executor, the default is
48 <code>5</code> (the value of the <code>Thread.NORM_PRIORITY</code> constant)</p>
49 </td></tr><tr><td align="left" valign="center"><code>daemon</code></td><td align="left" valign="center">
50 <p>(boolean) Whether the threads should be daemon threads or not, the default is <code>true</code></p>
51 </td></tr><tr><td align="left" valign="center"><code>namePrefix</code></td><td align="left" valign="center">
52 <p>(String) The name prefix for each thread created by the executor.
53 The thread name for an individual thread will be <code>namePrefix+threadNumber</code></p>
54 </td></tr><tr><td align="left" valign="center"><code>maxThreads</code></td><td align="left" valign="center">
55 <p>(int) The max number of active threads in this pool, default is <code>200</code></p>
56 </td></tr><tr><td align="left" valign="center"><code>minSpareThreads</code></td><td align="left" valign="center">
57 <p>(int) The minimum number of threads always kept alive, default is <code>25</code></p>
58 </td></tr><tr><td align="left" valign="center"><code>maxIdleTime</code></td><td align="left" valign="center">
59 <p>(int) The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less
60 or equal to minSpareThreads. Default value is <code>60000</code>(1 minute)</p>
61 </td></tr><tr><td align="left" valign="center"><code>maxQueueSize</code></td><td align="left" valign="center">
62 <p>(int) The maximum number of runnable tasks that can queue up awaiting
63 execution before we reject them. Default value is <code>Integer.MAX_VALUE</code></p>
64 </td></tr></table>
65
66
67 </blockquote></td></tr></table>
68</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
69 Copyright &copy; 1999-2014, Apache Software Foundation
70 </em></font></div></td></tr></table></body></html>