Being able to balance thread priorities for all kinds of threads
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 16 Mar 2007 19:48:21 +0000 (19:48 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 16 Mar 2007 19:48:21 +0000 (19:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@519111 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/Http11NioProtocol.java
java/org/apache/tomcat/util/net/NioEndpoint.java
webapps/docs/config/http.xml

index 9b390aa..055f0b7 100644 (file)
@@ -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() {
index 0a32a03..f9890c8 100644 (file)
@@ -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.
index e801291..42a5990 100644 (file)
         <p>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.</p>
       </attribute>
+      <attribute name="pollerThreadPriority" required="false">
+        <p>The priority of the poller threads.
+          The default value is <code>java.lang.Thread#NORM_PRIORITY</code>.
+          See the JavaDoc for the java.lang.Thread class for more details on
+          what this priority means.
+        </p>
+      </attribute>
+      <attribute name="acceptorThreadPriority" required="false">
+        <p>The priority of the acceptor threads. The threads used to accept new connections.
+          The default value is <code>java.lang.Thread#NORM_PRIORITY</code>.
+          See the JavaDoc for the java.lang.Thread class for more details on
+          what this priority means.
+        </p>
+      </attribute>
+      
       <attribute name="selectorTimeout" required="false">
         <p>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