tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shac...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util ThreadPool.java
Date Mon, 01 May 2000 12:29:09 GMT
shachor     00/05/01 05:29:09

  Modified:    src/share/org/apache/tomcat/util ThreadPool.java
  Log:
  Carry over a fix from Ver 3.1
  
  Revision  Changes    Path
  1.5       +32 -9     jakarta-tomcat/src/share/org/apache/tomcat/util/ThreadPool.java
  
  Index: ThreadPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/ThreadPool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ThreadPool.java	2000/02/29 13:43:26	1.4
  +++ ThreadPool.java	2000/05/01 12:29:09	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/ThreadPool.java,v
1.4 2000/02/29 13:43:26 shachor Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/02/29 13:43:26 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/ThreadPool.java,v
1.5 2000/05/01 12:29:09 shachor Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/05/01 12:29:09 $
    *
    * ====================================================================
    *
  @@ -228,8 +228,15 @@
               stopThePool = true;
               monitor.terminate();
               monitor = null;
  -            for(int i = 0 ; i < currentThreadCount ; i++) {
  -                ((ControlRunnable)(pool.elementAt(i))).terminate();
  +            for(int i = 0 ; i < (currentThreadCount - currentThreadsBusy) ; i++) {
  +                try {
  +                    ((ControlRunnable)(pool.elementAt(i))).terminate();
  +                } catch(Throwable t) {
  +                    /* 
  +					 * Do nothing... The show must go on, we are shutting 
  +					 * down the pool and nothing should stop that.
  +					 */
  +                }
               }
               currentThreadsBusy = currentThreadCount = 0;
               pool = null;
  @@ -285,12 +292,28 @@
               maxThreads = MAX_THREADS;
           }
   
  -        if(maxSpareThreads == maxThreads || maxSpareThreads <= 0) {
  -            maxSpareThreads = maxThreads/2;
  +        if(maxSpareThreads >= maxThreads) {
  +            maxSpareThreads = maxThreads;
           }
   
  -        if(minSpareThreads >=  maxSpareThreads || minSpareThreads <= 0) {
  -            minSpareThreads = maxSpareThreads/2;
  +		if(maxSpareThreads <= 0) {
  +            if(1 == maxThreads) {
  +                maxSpareThreads = 1;
  +            } else {
  +                maxSpareThreads = maxThreads/2;
  +            }
  +        }
  +
  +        if(minSpareThreads >  maxSpareThreads) {
  +            minSpareThreads =  maxSpareThreads;
  +		}
  +
  +		if(minSpareThreads <= 0) {
  +            if(1 == maxSpareThreads) {
  +                minSpareThreads = 1;
  +            } else {
  +                minSpareThreads = maxSpareThreads/2;
  +            }
           }
       }
   
  
  
  

Mime
View raw message