Fix dynamic thread resizing
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 21 Nov 2008 16:31:45 +0000 (16:31 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 21 Nov 2008 16:31:45 +0000 (16:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@719626 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioEndpoint.java

index 2ce7c68..ef2baa0 100644 (file)
@@ -354,8 +354,14 @@ public class NioEndpoint {
     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);
+                }
             }
         }
     }