larryi      00/12/02 17:51:27

  Modified:    src/facade22/org/apache/tomcat/modules/facade22
                        JspInterceptor.java
  Log:
  Change meaning of JspInfo.compileTime to "time of last attempted
  translate-and-compile".  At startup, set compileTime from the java file
  if the class file doesn't exist and the java file is found.
  
  This avoids retrying the translate-and-compile when it is just going to fail
  again.  If java source is being kept, each retry would create a new java
  file.
  
  Revision  Changes    Path
  1.11      +12 -4     
jakarta-tomcat/src/facade22/org/apache/tomcat/modules/facade22/JspInterceptor.java
  
  Index: JspInterceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/modules/facade22/JspInterceptor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JspInterceptor.java       2000/11/20 20:59:59     1.10
  +++ JspInterceptor.java       2000/12/03 01:51:27     1.11
  @@ -250,7 +250,10 @@
                
            // we will compile ourself
            compiler.setJavaCompiler( null );
  -         
  +
  +         // record time of attempted translate-and-compile
  +         jspInfo.touch();
  +
            synchronized ( this ) {
                compiler.compile();
            }
  @@ -258,7 +261,6 @@
            javac( createJavaCompiler( options ), ctxt, mangler );
            
            if(debug>0)log( "Compiled to " + jspInfo.realClassPath );
  -         jspInfo.touch();
        } catch( Exception ex ) {
            log("compile: req="+req+", jspInfo=" + jspInfo, ex);
        }
  @@ -382,7 +384,7 @@
       String mapPath; // In even of server reload, keep last version
   
       File jspSource; // used to avoid File allocation for lastModified
  -    long compileTime;// tstamp - avoid one extra access
  +    long compileTime;// tstamp of last compile attemp
   
       JspInfo( Request req ) {
        init( req );
  @@ -567,11 +569,17 @@
   
       /** After a startup we read the compile time from the class
        file lastModified. No further access to that file is done.
  +     If class file doesn't exist, use java file lastModified if
  +     it exists.  We don't need to re-translate if the java file
  +     has not expired.
       */
       void updateCompileTime() {
        File f=new File( realClassPath );
        compileTime=0;
  -     if( ! f.exists() ) return;
  +     if( ! f.exists() ) {
  +         f=new File( javaFilePath );
  +         if ( ! f.exists() ) return;
  +     }
        compileTime=f.lastModified();
       }
   
  
  
  

Reply via email to