You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2004/10/21 04:41:38 UTC

cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads Expirer.java

billbarker    2004/10/20 19:41:38

  Modified:    util/java/org/apache/tomcat/util/threads Expirer.java
  Log:
  Clean up references to TS when one is removed.
  
  Fix for Bug #31800
  Submitted By: David Blavier  david.blavier@one2team.com
  
  Revision  Changes    Path
  1.9       +6 -10     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Expirer.java
  
  Index: Expirer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/threads/Expirer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Expirer.java	17 Sep 2004 18:34:19 -0000	1.8
  +++ Expirer.java	21 Oct 2004 02:41:38 -0000	1.9
  @@ -82,8 +82,9 @@
   	for( int i=0; i< managedCount; i++ ) {
   	    if( ts == managedObjs[i] ) {
   		synchronized( managedObjs ) {
  -		    managedObjs[ i ] = managedObjs[managedCount-1];
   		    managedCount--;
  +		    managedObjs[ i ] = managedObjs[managedCount];
  +                    managedObjs[managedCount] = null;
   		}
   		return;
   	    }
  @@ -117,7 +118,7 @@
   
       public void runIt( Object td[] ) {
   	long timeNow = System.currentTimeMillis();
  -	if( dL > 2 ) debug( "Checking " + timeNow );
  +	if( log.isTraceEnabled() ) log.trace( "Checking " + timeNow );
   	int checkedCount;
   	synchronized( managedObjs ) {
   	    checkedCount=managedCount;
  @@ -133,7 +134,7 @@
   		continue;
   	    
   	    long maxInactiveInterval = ts.getMaxInactiveInterval();
  -	    if( dL > 3 ) debug( "TS: " + maxInactiveInterval + " " +
  +	    if( log.isTraceEnabled() ) log.trace( "TS: " + maxInactiveInterval + " " +
   				ts.getLastAccessedTime());
   	    if (maxInactiveInterval < 0)
   		continue;
  @@ -142,8 +143,8 @@
   	    
   	    if (timeIdle >= maxInactiveInterval) {
   		if( expireCallback != null ) {
  -		    if( dL > 0 )
  -			debug( ts + " " + timeIdle + " " +
  +		    if( log.isDebugEnabled() )
  +			log.debug( ts + " " + timeIdle + " " +
   			       maxInactiveInterval );
   		    expireCallback.expired( ts );
   		}
  @@ -151,9 +152,4 @@
   	}
       }
   
  -    private static final int dL=0;
  -    private void debug( String s ) {
  -        if (log.isDebugEnabled())
  -            log.debug("Expirer: " + s );
  -    }
   }
  
  
  

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