Hi Mark!

The NioEndpoint can have its own executor without sharing and JMX stuff :-)
See at start methods:

L 805:
if (getUseExecutor()) {
                if ( executor == null ) {
                    TaskQueue taskqueue = new TaskQueue();
TaskThreadFactory tf = new TaskThreadFactory (getName() + "-exec-"); executor = new ThreadPoolExecutor (getMinSpareThreads(), getMaxThreads(), 60, TimeUnit.SECONDS,taskqueue, tf); taskqueue.setParent( (ThreadPoolExecutor) executor, this);
                }


regards
Peter


Am 21.11.2008 um 23:52 schrieb Mark Thomas:

[EMAIL PROTECTED] wrote:
Author: fhanik
Date: Fri Nov 21 08:31:45 2008
New Revision: 719626

URL: http://svn.apache.org/viewvc?rev=719626&view=rev
Log:
Fix dynamic thread resizing

I had assumed that if an executor was used, then the executor mbean would
be used to resize the pool. Also, this is now inconsistent with the
configuration in that setting maxThreads for the connector in server.xml at startup will not have an affect but setting it via JMX at runtime will.

This is also now inconsistent with the BIO and APT endpoints.

Am I missing something?

Mark


Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/ NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/ tomcat/util/net/NioEndpoint.java? rev=719626&r1=719625&r2=719626&view=diff ===================================================================== ========= --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Fri Nov 21 08:31:45 2008
@@ -354,8 +354,14 @@
     public void setMaxThreads(int maxThreads) {
         this.maxThreads = maxThreads;
         if (running) {
-            synchronized(workers) {
-                workers.resize(maxThreads);
+            if (getUseExecutor() && executor!=null) {
+                if (executor instanceof ThreadPoolExecutor) {
+ ((ThreadPoolExecutor) executor).setMaximumPoolSize(maxThreads);
+                }
+            }else if (workers!=null){
+                synchronized(workers) {
+                    workers.resize(maxThreads);
+                }
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to