cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/threads ThreadPool.java

2001-11-02 Thread billbarker

billbarker01/11/02 21:58:46

  Modified:src/share/org/apache/tomcat/util/threads ThreadPool.java
  Log:
  Quit overriding the configuration settings.
  
  While this makes it possible to mis-configure connectors easier, that is your fault. 
 LATER can make adjustLimits deal with setting defaults if the admin sets goofy 
parameters.
  
  Fix for bug 4599
  Reported by: [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.8   +3 -6  
jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java
  
  Index: ThreadPool.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ThreadPool.java   2001/10/16 03:20:50 1.7
  +++ ThreadPool.java   2001/11/03 05:58:46 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.7 2001/10/16 03:20:50 costin Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/10/16 03:20:50 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.8 2001/11/03 05:58:46 billbarker Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/11/03 05:58:46 $
*
* 
*
  @@ -145,9 +145,6 @@
stopThePool=false;
   currentThreadCount  = 0;
   currentThreadsBusy  = 0;
  -maxThreads  = MAX_THREADS;
  -maxSpareThreads = MAX_SPARE_THREADS;
  -minSpareThreads = MIN_SPARE_THREADS;
   
   adjustLimits();
   
  
  
  

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




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/threads ThreadPool.java

2001-08-25 Thread costin

costin  01/08/25 18:55:59

  Modified:src/share/org/apache/tomcat/util/threads ThreadPool.java
  Log:
  Added an extra message for the first time we exceed maxThreads.
  
  Revision  ChangesPath
  1.6   +15 -3 
jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java
  
  Index: ThreadPool.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ThreadPool.java   2001/08/25 00:59:03 1.5
  +++ ThreadPool.java   2001/08/26 01:55:59 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.5 2001/08/25 00:59:03 nacho Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/08/25 00:59:03 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.6 2001/08/26 01:55:59 costin Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/08/26 01:55:59 $
*
* 
*
  @@ -211,6 +211,7 @@
   int toOpen = currentThreadCount + minSpareThreads;
   openThreads(toOpen);
   } else {
  + logFull(loghelper, currentThreadCount, maxThreads);
   // Wait for a thread to become idel.
   while(currentThreadsBusy == currentThreadCount) {
   try {
  @@ -239,6 +240,17 @@
   currentThreadsBusy++;
   }
   c.runIt(r);
  +}
  +
  +static boolean logfull=true;
  +public static void logFull(Log loghelper, int currentThreadCount, int 
maxThreads) {
  + if( logfull ) {
  + loghelper.log(All threads are busy, waiting. Please  +
  +   increase maxThreads or check the servlet +
  +status + currentThreadCount +   +
  +   maxThreads  );
  + logfull=false;
  + } 
   }
   
   /**
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/threads ThreadPool.java

2001-08-24 Thread nacho

nacho   01/08/24 17:59:03

  Modified:src/share/org/apache/tomcat/util/threads ThreadPool.java
  Log:
  Fix for Bugzilla#1745
  
  Possible problem with thread initialization in ThreadPool.java
  
  Reported by clay.olbon at raremedium.com
  
  Revision  ChangesPath
  1.5   +27 -26
jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java
  
  Index: ThreadPool.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ThreadPool.java   2001/04/21 18:42:51 1.4
  +++ ThreadPool.java   2001/08/25 00:59:03 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.4 2001/04/21 18:42:51 costin Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/04/21 18:42:51 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.5 2001/08/25 00:59:03 nacho Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/08/25 00:59:03 $
*
* 
*
  @@ -253,8 +253,8 @@
   try {
   ((ControlRunnable)(pool.elementAt(i))).terminate();
   } catch(Throwable t) {
  -/* 
  -  * Do nothing... The show must go on, we are shutting 
  +/*
  +  * Do nothing... The show must go on, we are shutting
 * down the pool and nothing should stop that.
 */
loghelper.log(Ignored exception while shutting down thread pool, 
t, Log.ERROR);
  @@ -267,7 +267,7 @@
   }
   
   /**
  - * Called by the monitor thread to harvest idel threads.
  + * Called by the monitor thread to harvest idle threads.
*/
   protected synchronized void checkSpareControllers() {
   
  @@ -307,7 +307,7 @@
   /**
* Inform the pool that the specific thread finish.
*
  - * Called by the ControlRunnable.run() when the runnable 
  + * Called by the ControlRunnable.run() when the runnable
* throws an exception.
*/
   protected synchronized void notifyThreadEnd(ControlRunnable c) {
  @@ -315,7 +315,7 @@
   currentThreadCount --;
   notify();
   }
  -
  +
   
   /*
* Checks for problematic configuration and fix it.
  @@ -331,7 +331,7 @@
   maxSpareThreads = maxThreads;
   }
   
  - if(maxSpareThreads = 0) {
  +if(maxSpareThreads = 0) {
   if(1 == maxThreads) {
   maxSpareThreads = 1;
   } else {
  @@ -341,9 +341,9 @@
   
   if(minSpareThreads   maxSpareThreads) {
   minSpareThreads =  maxSpareThreads;
  - }
  +}
   
  - if(minSpareThreads = 0) {
  +if(minSpareThreads = 0) {
   if(1 == maxSpareThreads) {
   minSpareThreads = 1;
   } else {
  @@ -475,31 +475,31 @@
   }
   
   public void run() {
  -
  +
   while(true) {
  -try { 
  +try {
/* Wait for work. */
   synchronized(this) {
   if(!shouldRun  !shouldTerminate) {
   this.wait();
   }
  +}
  +if(toRun == null ) {
  +if( p.debug0) p.log( No toRun ???);
   }
  - if(toRun == null ) {
  - if( p.debug0) p.log( No toRun ???);
  - }
  -
  - if( shouldTerminate ) {
  - if( p.debug0) p.log( Terminate);
  - break;
  - }
   
  +if( shouldTerminate ) {
  +if( p.debug0) p.log( Terminate);
  +break;
  +}
  +
   /* Check if should execute a runnable.  */
   try {
  - if(noThData) {
  - if(p.debug0) p.log( Getting new thread 
data);
  - thData=toRun.getInitData();
  - noThData = false;
  - }
  +if(noThData) {
  +if(p.debug0) p.log( Getting new thread data);
  +thData=toRun.getInitData();
  +noThData = false;
  +}
   
   if(shouldRun) {

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/threads ThreadPool.java

2001-04-21 Thread costin

costin  01/04/21 11:42:51

  Modified:src/share/org/apache/tomcat/util/threads ThreadPool.java
  Log:
  1418 - stop/start puts the thread pool in the same state ( all the threads are
  stoped, then shouldStop is reset to false and we restart ).
  
  Reduced the min threads ( thread creation is much cheaper than process
  creation, and after the threads are created they will remain allocated ).
  Also, increased max threads - tomcat can now handle way over 100 RPS, no need
  to limit it in the thread pool settings.
  
  Revision  ChangesPath
  1.4   +13 -5 
jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java
  
  Index: ThreadPool.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ThreadPool.java   2001/03/02 04:11:52 1.3
  +++ ThreadPool.java   2001/04/21 18:42:51 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.3 2001/03/02 04:11:52 costin Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/03/02 04:11:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/threads/ThreadPool.java,v 
1.4 2001/04/21 18:42:51 costin Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/04/21 18:42:51 $
*
* 
*
  @@ -79,9 +79,9 @@
   /*
* Default values ...
*/
  -public static final int MAX_THREADS = 100;
  +public static final int MAX_THREADS = 200;
   public static final int MAX_SPARE_THREADS = 50;
  -public static final int MIN_SPARE_THREADS = 10;
  +public static final int MIN_SPARE_THREADS = 4;
   public static final int WORK_WAIT_TIMEOUT = 60*1000;
   
   /*
  @@ -142,6 +142,13 @@
   }
   
   public synchronized void start() {
  + stopThePool=false;
  +currentThreadCount  = 0;
  +currentThreadsBusy  = 0;
  +maxThreads  = MAX_THREADS;
  +maxSpareThreads = MAX_SPARE_THREADS;
  +minSpareThreads = MIN_SPARE_THREADS;
  +
   adjustLimits();
   
   openThreads(minSpareThreads);
  @@ -378,6 +385,7 @@
   shouldTerminate = false;
   this.p = p;
   t = new Thread(this);
  + t.setName( "MonitorRunnable" );
   t.start();
   }