luehe       2004/05/24 14:33:48

  Modified:    jasper2/src/share/org/apache/jasper/compiler Compiler.java
               jasper2/src/share/org/apache/jasper/servlet
                        JspServletWrapper.java
  Log:
  Added support for JSP compilations in a clustered env, where one
  server instance may use JSPs compiled by another server instance.
  
  Assume a JSP named foo.jsp, along with these timestamps:
  
    t1    = Timestamp of foo.jsp
    t2    = Timestamp of foo.class
  
    SI_1  = ServerInstance_1
    SI_2  = ServerInstance_2
  
  Problem description:
  
  - Suppose SI_1 compiles foo.jsp and loads corresponding class file.
  
  - foo.jsp is subsequently modified and recompiled by SI_2.
  
  - SI_1 accesses foo.jsp: Since t2>t1, it determines that no
    recompilation is necessary, and services the cached (outdated) class
    file
  
  With this commit, SI_1 will reload foo.class and service its updated contents.
  
  Revision  Changes    Path
  1.87      +3 -0      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- Compiler.java     21 May 2004 17:52:59 -0000      1.86
  +++ Compiler.java     24 May 2004 21:33:48 -0000      1.87
  @@ -543,6 +543,9 @@
               outDated = true;
           } else {
               targetLastModified = targetFile.lastModified();
  +            if (checkClass) {
  +                jsw.setServletClassLastModifiedTime(targetLastModified);
  +            }   
               if (targetLastModified < jspRealLastModified) {
                   if( log.isDebugEnabled() ) {
                       log.debug("Compiler: outdated: " + targetFile + " " +
  
  
  
  1.37      +18 -0     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java
  
  Index: JspServletWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- JspServletWrapper.java    24 May 2004 21:22:00 -0000      1.36
  +++ JspServletWrapper.java    24 May 2004 21:33:48 -0000      1.37
  @@ -74,6 +74,7 @@
       private boolean isTagFile;
       private int tripCount;
       private JasperException compileException;
  +    private long servletClassLastModifiedTime;
   
       /*
        * JspServletWrapper for JSP pages.
  @@ -164,6 +165,23 @@
        */
       public void setCompilationException(JasperException je) {
           this.compileException = je;
  +    }
  +
  +    /**
  +     * Sets the last-modified time of the servlet class file associated with
  +     * this JspServletWrapper.
  +     *
  +     * @param lastModified Last-modified time of servlet class
  +     */
  +    public void setServletClassLastModifiedTime(long lastModified) {
  +        if (this.servletClassLastModifiedTime < lastModified) {
  +            synchronized (this) {
  +                if (this.servletClassLastModifiedTime < lastModified) {
  +                    this.servletClassLastModifiedTime = lastModified;
  +                    reload = true;
  +                }
  +            }
  +        }
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to