You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2005/05/25 14:45:38 UTC

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java InternalAprInputBuffer.java

remm        2005/05/25 05:45:38

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11AprProcessor.java InternalAprInputBuffer.java
  Log:
  - If the thread count gets too high, don't do any blocking read to start off
    the request if no data is available, and put the socket in the poller.
  
  Revision  Changes    Path
  1.13      +3 -1      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Http11AprProcessor.java	22 May 2005 17:12:11 -0000	1.12
  +++ Http11AprProcessor.java	25 May 2005 12:45:38 -0000	1.13
  @@ -751,6 +751,8 @@
   
           int keepAliveLeft = maxKeepAliveRequests;
           long soTimeout = endpoint.getSoTimeout();
  +        
  +        int limit = (endpoint.getMaxThreads() * 3) / 4;
   
           boolean keptAlive = false;
           boolean openSocket = false;
  @@ -762,7 +764,7 @@
                   if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
                       Socket.timeoutSet(socket, soTimeout * 1000);
                   }
  -                if (!inputBuffer.parseRequestLine()) {
  +                if (!inputBuffer.parseRequestLine(endpoint.getCurrentThreadsBusy() > limit)) {
                       // This means that no data is available right now
                       // (long keepalive), so that the processor should be recycled
                       // and the method should return true
  
  
  
  1.7       +7 -1      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
  
  Index: InternalAprInputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InternalAprInputBuffer.java	15 May 2005 15:49:31 -0000	1.6
  +++ InternalAprInputBuffer.java	25 May 2005 12:45:38 -0000	1.7
  @@ -386,7 +386,7 @@
        * @return true if data is properly fed; false if no data is available 
        * immediately and thread should be freed
        */
  -    public boolean parseRequestLine()
  +    public boolean parseRequestLine(boolean useAvailableData)
           throws IOException {
   
           int start = 0;
  @@ -400,6 +400,9 @@
   
               // Read new bytes if needed
               if (pos >= lastValid) {
  +                if (useAvailableData) {
  +                    return false;
  +                }
                   // Do a simple read with a short timeout
                   bbuf.clear();
                   int nRead = Socket.recvbt
  @@ -427,6 +430,9 @@
           start = pos;
   
           if (pos >= lastValid) {
  +            if (useAvailableData) {
  +                return false;
  +            }
               // Do a simple read with a short timeout
               bbuf.clear();
               int nRead = Socket.recvbt
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org