Author: markt
Date: Wed Nov 6 20:19:52 2013
New Revision: 1539453
URL: http://svn.apache.org/r1539453
Log:
Make the time the internal executor waits for request processing threads to
terminate before continuing with the connector stop process configurable.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1539452
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1539453&r1=1539452&r2=1539453&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
Wed Nov 6 20:19:52 2013
@@ -117,6 +117,7 @@ public abstract class AbstractEndpoint {
*/
protected volatile boolean internalExecutor = false;
+
/**
* counter for nr of connections handled by an endpoint
*/
@@ -139,9 +140,26 @@ public abstract class AbstractEndpoint {
// -----------------------------------------------------------------
Properties
/**
+ * Time to wait for the internal executor (if used) to terminate when the
+ * endpoint is stopped in milliseconds. Defaults to 5000 (5 seconds).
+ */
+ private long executorTerminationTimeoutMillis = 5000;
+
+ public long getExecutorTerminationTimeoutMillis() {
+ return executorTerminationTimeoutMillis;
+ }
+
+ public void setExecutorTerminationTimeoutMillis(
+ long executorTerminationTimeoutMillis) {
+ this.executorTerminationTimeoutMillis =
executorTerminationTimeoutMillis;
+ }
+
+
+ /**
* Acceptor thread count.
*/
protected int acceptorThreadCount = 0;
+
public void setAcceptorThreadCount(int acceptorThreadCount) {
this.acceptorThreadCount = acceptorThreadCount;
}
@@ -505,7 +523,8 @@ public abstract class AbstractEndpoint {
ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor;
tpe.shutdownNow();
try {
- tpe.awaitTermination(5000, TimeUnit.MILLISECONDS);
+ tpe.awaitTermination(getExecutorTerminationTimeoutMillis(),
+ TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Ignore
}
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1539453&r1=1539452&r2=1539453&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Wed
Nov 6 20:19:52 2013
@@ -71,6 +71,9 @@ public class JIoEndpoint extends Abstrac
// Set maxConnections to zero so we can tell if the user has specified
// their own value on the connector when we reach bind()
setMaxConnections(0);
+ // Reduce the executor timeout for BIO as threads in keep-alive will
not
+ // terminate when the executor interrupts them.
+ setExecutorTerminationTimeoutMillis(0);
}
// ------------------------------------------------------------- Properties
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1539453&r1=1539452&r2=1539453&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Nov 6 20:19:52 2013
@@ -136,6 +136,11 @@
using non-blocking IO. A side effect of not doing this was that JNDI
was
not available when processing WebSocket events. (markt)
</fix>
+ <add>
+ Make the time that the internal executor (if used) waits for request
+ processing threads to terminate before continuing with the connector
+ stop process configurable. (markt)
+ </add>
</changelog>
</subsection>
<subsection name="Cluster">
Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml?rev=1539453&r1=1539452&r2=1539453&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/ajp.xml Wed Nov 6 20:19:52 2013
@@ -337,6 +337,14 @@
provide the thread pool.</p>
</attribute>
+ <attribute name="executorTerminationTimeoutMillis" required="false">
+ <p>The time that the private internal executor will wait for request
+ processing threads to terminate before continuing with the process of
+ stopping the connector. If not set, the default is <code>0</code> (zero)
+ for the BIO connector and <code>5000</code> (5 seconds) for the NIO and
+ APR/native connectors.</p>
+ </attribute>
+
<attribute name="keepAliveTimeout" required="false">
<p>The number of milliseconds this <strong>Connector</strong> will wait
for
another AJP request before closing the connection.
Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml?rev=1539453&r1=1539452&r2=1539453&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/http.xml Wed Nov 6 20:19:52 2013
@@ -373,6 +373,14 @@
provide the thread pool.</p>
</attribute>
+ <attribute name="executorTerminationTimeoutMillis" required="false">
+ <p>The time that the private internal executor will wait for request
+ processing threads to terminate before continuing with the process of
+ stopping the connector. If not set, the default is <code>0</code> (zero)
+ for the BIO connector and <code>5000</code> (5 seconds) for the NIO and
+ APR/native connectors.</p>
+ </attribute>
+
<attribute name="keepAliveTimeout" required="false">
<p>The number of milliseconds this <strong>Connector</strong> will wait
for another HTTP request before closing the connection. The default value
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]