From: fhanik Date: Fri, 16 Mar 2007 19:48:21 +0000 (+0000) Subject: Being able to balance thread priorities for all kinds of threads X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cb41babeb6ff4f84a91bf2c721203e2cb78aa9ef;p=tomcat7.0 Being able to balance thread priorities for all kinds of threads git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@519111 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/http11/Http11NioProtocol.java b/java/org/apache/coyote/http11/Http11NioProtocol.java index 9b390aa7c..055f0b76d 100644 --- a/java/org/apache/coyote/http11/Http11NioProtocol.java +++ b/java/org/apache/coyote/http11/Http11NioProtocol.java @@ -274,11 +274,30 @@ public class Http11NioProtocol implements ProtocolHandler, MBeanRegistration ep.setThreadPriority(threadPriority); setAttribute("threadPriority", "" + threadPriority); } + + public void setAcceptorThreadPriority(int threadPriority) { + ep.setAcceptorThreadPriority(threadPriority); + setAttribute("acceptorThreadPriority", "" + threadPriority); + } + + public void setPollerThreadPriority(int threadPriority) { + ep.setPollerThreadPriority(threadPriority); + setAttribute("pollerThreadPriority", "" + threadPriority); + } public int getThreadPriority() { return ep.getThreadPriority(); } + public int getAcceptorThreadPriority() { + return ep.getAcceptorThreadPriority(); + } + + public int getPollerThreadPriority() { + return ep.getThreadPriority(); + } + + // -------------------- Tcp setup -------------------- public int getBacklog() { diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 0a32a030e..f9890c8fa 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -103,6 +103,7 @@ public class NioEndpoint { public static final String SESSION_ID_KEY = "javax.servlet.request.ssl_session"; public static final int OP_REGISTER = -1; //register interest op + // ----------------------------------------------------------------- Fields @@ -318,12 +319,25 @@ public class NioEndpoint { /** - * Priority of the acceptor and poller threads. + * Priority of the worker threads. */ protected int threadPriority = Thread.NORM_PRIORITY; public void setThreadPriority(int threadPriority) { this.threadPriority = threadPriority; } public int getThreadPriority() { return threadPriority; } + /** + * Priority of the acceptor threads. + */ + protected int acceptorThreadPriority = Thread.NORM_PRIORITY; + public void setAcceptorThreadPriority(int acceptorThreadPriority) { this.acceptorThreadPriority = acceptorThreadPriority; } + public int getAcceptorThreadPriority() { return acceptorThreadPriority; } + + /** + * Priority of the poller threads. + */ + protected int pollerThreadPriority = Thread.NORM_PRIORITY; + public void setPollerThreadPriority(int pollerThreadPriority) { this.pollerThreadPriority = pollerThreadPriority; } + public int getPollerThreadPriority() { return pollerThreadPriority; } /** * Server socket port. diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml index e801291fc..42a5990f2 100644 --- a/webapps/docs/config/http.xml +++ b/webapps/docs/config/http.xml @@ -412,6 +412,21 @@

The number of threads to be used to run for the polling events. Default value is 1. Can't see a reason to go above that. But experiment and find your own results.

+ +

The priority of the poller threads. + The default value is java.lang.Thread#NORM_PRIORITY. + See the JavaDoc for the java.lang.Thread class for more details on + what this priority means. +

+
+ +

The priority of the acceptor threads. The threads used to accept new connections. + The default value is java.lang.Thread#NORM_PRIORITY. + See the JavaDoc for the java.lang.Thread class for more details on + what this priority means. +

+
+

The time in milliseconds to timeout on a select() for the poller. This value is important, since connection clean up is done on the same thread, so dont set this