You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/08 05:12:50 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/depend DependManager.java Dependency.java

costin      01/06/07 20:12:49

  Modified:    src/share/org/apache/tomcat/util/depend DependManager.java
                        Dependency.java
  Log:
  Added a toString method to Dependency ( for easy debug/messages ).
  
  Added few convenience methods to DependManager.
  
  Revision  Changes    Path
  1.6       +23 -1     jakarta-tomcat/src/share/org/apache/tomcat/util/depend/DependManager.java
  
  Index: DependManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/depend/DependManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DependManager.java	2001/03/07 23:39:20	1.5
  +++ DependManager.java	2001/06/08 03:12:45	1.6
  @@ -76,7 +76,7 @@
    */
   public class DependManager {
       int delay=4000;
  -    Dependency deps[]=new Dependency[32];
  +    Dependency deps[];
       int depsCount=0;
       long lastCheck=0;
       boolean checking=false;
  @@ -84,8 +84,15 @@
       int checkCount=0;
   
       private boolean expired=false;
  +
  +    static final int INITIAL_DEP_SIZE=32;
       
       public DependManager() {
  +	this( INITIAL_DEP_SIZE );
  +    }
  +
  +    public DependManager(int initial_size) {
  +	deps=new Dependency[initial_size];
       }
   
       /** Reset the depend manager - all dependencies are reset too.
  @@ -177,6 +184,21 @@
   	}
       }
   
  +    /** Update all times, so next "shouldReload" will happen if
  +     *  any time changes ( after the specified time )
  +     */
  +    public void setLastModified( long time ) {
  +	for( int i=0; i<depsCount; i++ ) {
  +	    deps[i].setLastModified( time );
  +	}
  +    }
  +
  +    public void setExpired( boolean e ) {
  +	for( int i=0; i<depsCount; i++ ) {
  +	    deps[i].setExpired( e );
  +	}
  +    }
  +    
       public synchronized void addDependency( Dependency dep ) {
   	if( depsCount >= deps.length ) {
   	    Dependency deps1[]=new Dependency[ deps.length *2 ];
  
  
  
  1.4       +6 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/depend/Dependency.java
  
  Index: Dependency.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/depend/Dependency.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Dependency.java	2001/03/07 23:39:20	1.3
  +++ Dependency.java	2001/06/08 03:12:46	1.4
  @@ -150,7 +150,12 @@
   	return target;
       }
       
  -
  +    public String toString() {
  +	return "Dep(O=" + origin + " LM=" + lastModified +
  +	    " OLM=" + ((origin!=null) ? origin.lastModified() :0) +
  +	    " E=" + expired + ") ";
  +    }
  +    
       // -------------------- methods --------------------
   
       /** Check if the origin changed since target's was lastModified.