Author: markt
Date: Mon Jul 24 13:48:45 2017
New Revision: 1802814
URL: http://svn.apache.org/viewvc?rev=1802814&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=61322
Correct two regressions caused by the fix for bug 60319 when using BIO with an
external Executor. Firstly, use the maxThreads setting from the Executor as the
default for maxConnections if none is specified. Secondly, use maxThreads from
the Executor when calculating the point at which to disable keep-alive.
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1802814&r1=1802813&r2=1802814&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Mon
Jul 24 13:48:45 2017
@@ -107,7 +107,7 @@ public class Http11Processor extends Abs
// Only calculate a thread ratio when both are >0 to ensure we get a
// sensible result
int maxThreads, threadsBusy;
- if ((maxThreads = endpoint.getMaxThreads()) > 0
+ if ((maxThreads = endpoint.getMaxThreadsWithExecutor()) > 0
&& (threadsBusy = endpoint.getCurrentThreadsBusy()) > 0) {
threadRatio = (threadsBusy * 100) / maxThreads;
}
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1802814&r1=1802813&r2=1802814&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
Mon Jul 24 13:48:45 2017
@@ -421,6 +421,19 @@ public abstract class AbstractEndpoint<S
protected int getMaxThreadsInternal() {
return maxThreads;
}
+ public int getMaxThreadsWithExecutor() {
+ Executor executor = this.executor;
+ if (internalExecutor) {
+ return maxThreads;
+ } else {
+ if (executor instanceof java.util.concurrent.ThreadPoolExecutor) {
+ return ((java.util.concurrent.ThreadPoolExecutor)
executor).getMaximumPoolSize();
+ } else if (executor instanceof ResizableExecutor) {
+ return ((ResizableExecutor) executor).getMaxThreads();
+ }
+ return -1;
+ }
+ }
/**
Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1802814&r1=1802813&r2=1802814&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
(original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Mon
Jul 24 13:48:45 2017
@@ -348,7 +348,7 @@ public class JIoEndpoint extends Abstrac
// Initialize maxConnections
if (getMaxConnections() == 0) {
// User hasn't set a value - use the default
- setMaxConnections(getMaxThreadsInternal());
+ setMaxConnections(getMaxThreadsWithExecutor());
}
if (serverSocketFactory == null) {
Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1802814&r1=1802813&r2=1802814&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Mon Jul 24 13:48:45 2017
@@ -82,6 +82,18 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ <bug>61322</bug>: Correct two regressions caused by the fix for
+ <bug>60319</bug> when using BIO with an external Executor. Firstly, use
+ the <code>maxThreads</code> setting from the Executor as the default
for
+ <code>maxConnections</code> if none is specified. Secondly, use
+ <code>maxThreads</code> from the Executor when calculating the point at
+ which to disable keep-alive. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Jasper">
<changelog>
<add>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]