tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core ApplicationDispatcher.java
Date Fri, 23 Jun 2000 17:51:18 GMT
craigmcc    00/06/23 10:51:17

  Modified:    proposals/catalina/src/share/org/apache/tomcat/connector
                        ResponseBase.java
               proposals/catalina/src/share/org/apache/tomcat/core
                        ApplicationDispatcher.java
  Log:
  Tune the performance of the write(b, off, len) method, based on the code
  currently used in Tomcat 3.x.
  
  Actually commit the change to ApplicationDispatcher (removing the
  response.flushBuffer() call in the RequestDispatcher.include()
  implementation) that was mentioned in the previous commit.
  
  Revision  Changes    Path
  1.15      +25 -6     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java
  
  Index: ResponseBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ResponseBase.java	2000/06/23 01:38:29	1.14
  +++ ResponseBase.java	2000/06/23 17:51:14	1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
1.14 2000/06/23 01:38:29 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2000/06/23 01:38:29 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/ResponseBase.java,v
1.15 2000/06/23 17:51:14 craigmcc Exp $
  + * $Revision: 1.15 $
  + * $Date: 2000/06/23 17:51:14 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    * the connector-specific methods need to be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.14 $ $Date: 2000/06/23 01:38:29 $
  + * @version $Revision: 1.15 $ $Date: 2000/06/23 17:51:14 $
    */
   
   public abstract class ResponseBase
  @@ -517,8 +517,27 @@
        */
       public void write(byte b[], int off, int len) throws IOException {
   
  -	for (int i = off; i < (off+len); i++)
  -	    write(b[i]);
  +	// If the whole thing fits in the buffer, just put it there
  +	if (len == 0)
  +	    return;
  +	if (len <= (buffer.length - bufferCount)) {
  +	    System.arraycopy(b, off, buffer, bufferCount, len);
  +	    bufferCount += len;
  +	    contentCount += len;
  +	    return;
  +	}
  +
  +	// Flush the buffer and start writing full-buffer-size chunks
  +	flushBuffer();
  +	int iterations = len / buffer.length;
  +	int leftoverStart = iterations * buffer.length;
  +	int leftoverLen = len - leftoverStart;
  +	for (int i = 0; i < iterations; i++)
  +	    write(b, off + (i * buffer.length), buffer.length);
  +
  +	// Write the remainder (guaranteed to fit in the buffer)
  +	if (leftoverLen > 0)
  +	    write(b, off + leftoverStart, leftoverLen);
   
       }
   
  
  
  
  1.9       +5 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ApplicationDispatcher.java	2000/06/23 01:38:30	1.8
  +++ ApplicationDispatcher.java	2000/06/23 17:51:16	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
1.8 2000/06/23 01:38:30 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/06/23 01:38:30 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
1.9 2000/06/23 17:51:16 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/06/23 17:51:16 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * from this resource.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/06/23 01:38:30 $
  + * @version $Revision: 1.9 $ $Date: 2000/06/23 17:51:16 $
    */
   
   final class ApplicationDispatcher
  @@ -326,7 +326,7 @@
   
   	// Flush the response to avoid allowing the included resource
   	// to set headers
  -	response.flushBuffer();
  +	//	response.flushBuffer();
   
   	// Cast the servlet request and response to our internal objects
   	Request srequest = (Request) request;
  
  
  

Mime
View raw message