luehe       2003/10/30 13:01:39

  Modified:    util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  Fixed problem where if maxThreads is set to 1,
  ThreadPool.findControlRunnable() will log this error on the first
  request:
  
    SEVERE: All threads (1) are currently busy, waiting. Increase
    maxThreads (1) or check the servlet status
  
  and then block forever
  
  Revision  Changes    Path
  1.26      +24 -9     
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- PoolTcpEndpoint.java      22 Oct 2003 13:46:28 -0000      1.25
  +++ PoolTcpEndpoint.java      30 Oct 2003 21:01:39 -0000      1.26
  @@ -544,7 +544,7 @@
        }
       }
       
  -    public void runIt(Object perThrData[]) {
  +    public void runIt(Object[] perThrData) {
   
        // Create per-thread cache
        if (endpoint.isRunning()) {
  @@ -552,11 +552,16 @@
            try {
                   s = endpoint.acceptSocket();
            } finally {
  -             // Continue accepting on another thread...
  -                if (endpoint.isRunning()) {
  +                /*
  +                 * Continue accepting on another thread, unless maxThreads has
  +                 * been set to 1, in which case we have to finish processing
  +                 * this request before we can accept a new request.
  +                 */
  +                if (endpoint.isRunning() && endpoint.getMaxThreads() > 1) {
                       endpoint.tp.runIt(this);
                   }
               }
  +
            if (null != s) {
                
                try {
  @@ -574,19 +579,24 @@
   
                   TcpConnection con = null;
                   try {
  +                    Object[] localPerThrData = null;
                    if( usePool ) {
                        con=(TcpConnection)connectionCache.get();
  -                     if( con == null ) 
  +                     if( con == null ) {
                            con = new TcpConnection();
  +                     }
  +                        localPerThrData = perThrData;
                    } else {
                           con = (TcpConnection) perThrData[0];
  -                        perThrData = (Object []) perThrData[1];
  +                        localPerThrData = (Object[]) perThrData[1];
                    }
                    
                    con.setEndpoint(endpoint);
                    con.setSocket(s);
                    endpoint.setSocketOptions( s );
  -                 endpoint.getConnectionHandler().processConnection(con, perThrData);
  +                 endpoint.getConnectionHandler().processConnection(
  +                                                            con,
  +                                                            localPerThrData);
                   } catch (SocketException se) {
                       endpoint.log.error(
                          "Remote Host " + s.getInetAddress() +
  @@ -610,6 +620,11 @@
                       }
                   }
            }
  +
  +            if (endpoint.getMaxThreads() == 1) {
  +                // Ready to accept new request
  +                runIt(perThrData);
  +            }
        }
       }
   
  
  
  

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

Reply via email to