tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade Servlet22Interceptor.java
Date Fri, 23 Mar 2001 03:28:56 GMT
costin      01/03/22 19:28:56

  Modified:    src/facade22/org/apache/tomcat/facade
                        Servlet22Interceptor.java
  Log:
  Lazy allocation of the Vector - in the most common case there are no
  BindingListeners, and we'll not need the vector. It is probably possible
  to avoid it for all cases, if anyone would spend the time to do so.
  
  Revision  Changes    Path
  1.14      +9 -6      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java
  
  Index: Servlet22Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/Servlet22Interceptor.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Servlet22Interceptor.java	2001/03/22 01:44:11	1.13
  +++ Servlet22Interceptor.java	2001/03/23 03:28:55	1.14
  @@ -176,7 +176,7 @@
   	    // expired
   	    HttpSession httpSess=(HttpSession)sess.getFacade();
   
  -	    Vector removed=new Vector();
  +	    Vector removed=null; // lazy 
   	    Enumeration e = sess.getAttributeNames();
   	    // announce all values with listener that we'll remove them
   	    while( e.hasMoreElements() )   {
  @@ -186,14 +186,17 @@
   		if( value instanceof  HttpSessionBindingListener) {
   		    ((HttpSessionBindingListener) value).valueUnbound
   			(new HttpSessionBindingEvent(httpSess , key));
  +		    if( removed=null) removed=new Vector();
   		    removed.addElement( key );
   		}
   	    }
  -	    // remove
  -	    e=removed.elements();
  -	    while( e.hasMoreElements() ) {
  -		String key = (String) e.nextElement();
  -		sess.removeAttribute( key );
  +	    if( removed!=null ) {
  +		// remove
  +		e=removed.elements();
  +		while( e.hasMoreElements() ) {
  +		    String key = (String) e.nextElement();
  +		    sess.removeAttribute( key );
  +		}
   	    }
   	} 
   	return 0;
  
  
  

Mime
View raw message