tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/service/http HttpConnectionHandler.java
Date Sun, 16 Apr 2000 17:37:47 GMT
costin      00/04/16 10:37:47

  Modified:    src/share/org/apache/tomcat/service PoolTcpEndpoint.java
               src/share/org/apache/tomcat/service/http
                        HttpConnectionHandler.java
  Log:
  Added Request/Response recycling to PoolConnection and HttpAdapter.
  This is just the first step - we need to do it for Ajp and Jni too.
  
  For SimpleConnection - I guess there is no need to spend time on it
  right now, but keep it simple. We should choose what components are to
  be used in the "production" mode and spend the most time on them.
  
  Revision  Changes    Path
  1.3       +8 -5      jakarta-tomcat/src/share/org/apache/tomcat/service/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/PoolTcpEndpoint.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PoolTcpEndpoint.java	2000/03/20 19:34:10	1.2
  +++ PoolTcpEndpoint.java	2000/04/16 17:37:46	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/PoolTcpEndpoint.java,v
1.2 2000/03/20 19:34:10 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/03/20 19:34:10 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/PoolTcpEndpoint.java,v
1.3 2000/04/16 17:37:46 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/16 17:37:46 $
    *
    * ====================================================================
    *
  @@ -332,7 +332,10 @@
       }
   
       public void run() {
  -	    while(endpoint.running) {
  +	// Create per-thread cache
  +	Object perThrData[]=endpoint.getConnectionHandler().init();
  +	while(endpoint.running) {
  +		
   		//		System.out.println("XXX accept socket");
   	        Socket s = endpoint.acceptSocket();
   		//		System.out.print("Ac");
  @@ -356,7 +359,7 @@
   
                   	con.setEndpoint(endpoint);
                   	con.setSocket(s);
  -                	endpoint.getConnectionHandler().processConnection(con, null);
  +                	endpoint.getConnectionHandler().processConnection(con, perThrData);
                   } finally {
                       con.recycle();
                       connectionCache.addElement(con);
  
  
  
  1.18      +21 -7     jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java
  
  Index: HttpConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- HttpConnectionHandler.java	2000/03/24 03:29:38	1.17
  +++ HttpConnectionHandler.java	2000/04/16 17:37:47	1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
1.17 2000/03/24 03:29:38 craigmcc Exp $
  - * $Revision: 1.17 $
  - * $Date: 2000/03/24 03:29:38 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
1.18 2000/04/16 17:37:47 costin Exp $
  + * $Revision: 1.18 $
  + * $Date: 2000/04/16 17:37:47 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,14 @@
       }
   
       public Object[] init( ) {
  -	return null;
  +	Object thData[]=new Object[2];
  +	HttpRequestAdapter reqA=new HttpRequestAdapter();
  +	HttpResponseAdapter resA=new HttpResponseAdapter();
  +	
  +	thData[0]=reqA;
  +	thData[1]=resA;
  +	
  +	return  thData;
       }
   
       // XXX
  @@ -117,11 +124,18 @@
   	    //	    System.out.print("2");
   	    InputStream in=socket.getInputStream();
   	    OutputStream out=socket.getOutputStream();
  +	    HttpRequestAdapter reqA=null;
  +	    HttpResponseAdapter resA=null;
  +	    if( thData != null ) {
  +		reqA=(HttpRequestAdapter)thData[0];
  +		resA=(HttpResponseAdapter)thData[1];
  +		if( reqA!=null ) reqA.recycle();
  +		if( resA!=null ) resA.recycle();
  +	    }
  +	    if( reqA==null) reqA=new HttpRequestAdapter();
  +	    if( resA==null) resA=new HttpResponseAdapter();
   
  -	    HttpRequestAdapter reqA=new HttpRequestAdapter();
   	    reqA.setContextManager( contextM );
  -
  -	    HttpResponseAdapter resA=new HttpResponseAdapter();
   	    
   	    resA.setRequest(reqA);
   	    reqA.setResponse( resA );
  
  
  

Mime
View raw message