remm        2005/05/26 02:06:16

  Modified:    util/java/org/apache/tomcat/util/net AprEndpoint.java
               http11/src/java/org/apache/coyote/http11
                        Http11AprProcessor.java
  Log:
  - Allow using a firstRead value <= 0 to specify to always use the poller for
    keepalive. The first request processed by the processor will always wait a
    little before going back to the poller.
  - Also use 5ms instead of 100ms for pollTime (it doesn't seem to have any
    performance impact, or it's just that my computer is fast). 1ms does have a
    (very small) performance impact, however.
  
  Revision  Changes    Path
  1.31      +1 -1      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AprEndpoint.java  23 May 2005 06:04:02 -0000      1.30
  +++ AprEndpoint.java  26 May 2005 09:06:16 -0000      1.31
  @@ -255,7 +255,7 @@
        * Poll interval, in microseconds. The smaller the value, the more CPU 
the poller
        * will use, but the more responsive to activity it will be.
        */
  -    protected int pollTime = 100000;
  +    protected int pollTime = 5000;
       public int getPollTime() { return pollTime; }
       public void setPollTime(int pollTime) { this.pollTime = pollTime; }
   
  
  
  
  1.14      +12 -4     
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Http11AprProcessor.java   25 May 2005 12:45:38 -0000      1.13
  +++ Http11AprProcessor.java   26 May 2005 09:06:16 -0000      1.14
  @@ -77,8 +77,12 @@
           this.endpoint = endpoint;
           
           request = new Request();
  -        inputBuffer = new InternalAprInputBuffer(request, headerBufferSize, 
  -                endpoint.getFirstReadTimeout());
  +        int readTimeout = endpoint.getFirstReadTimeout();
  +        if (readTimeout <= 0) {
  +            readTimeout = 100;
  +        }
  +        inputBuffer = new InternalAprInputBuffer(request, headerBufferSize,
  +                readTimeout);
           request.setInputBuffer(inputBuffer);
   
           response = new Response();
  @@ -752,7 +756,10 @@
           int keepAliveLeft = maxKeepAliveRequests;
           long soTimeout = endpoint.getSoTimeout();
           
  -        int limit = (endpoint.getMaxThreads() * 3) / 4;
  +        int limit = 0;
  +        if (endpoint.getFirstReadTimeout() > 0) {
  +            limit = (endpoint.getMaxThreads() * 3) / 4;
  +        }
   
           boolean keptAlive = false;
           boolean openSocket = false;
  @@ -764,7 +771,8 @@
                   if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
                       Socket.timeoutSet(socket, soTimeout * 1000);
                   }
  -                if 
(!inputBuffer.parseRequestLine(endpoint.getCurrentThreadsBusy() > limit)) {
  +                if (!inputBuffer.parseRequestLine
  +                        (keptAlive && (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
  
  
  

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

Reply via email to