DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43741>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43741

           Summary: .tag files in a .tar recompiled for each .jsp --
                    extremely slow (with fix)
           Product: Tomcat 6
           Version: 6.0.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Jasper
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Jasper is *extremely* slow at compiling .tag files packaged in a .jar -- tens 
of seconds per JSP. One cause is that .tag files are repeatedly recompiled for 
each .jsp even though they have not changed.

The following few lines fix this.  The added code is marked between // --------
 AJB markers.  
It effectively turns off the timestamp checking on .jar files.

This does NOT actually introduce a bug.  There is an existing bug in that .jsp 
files are not 
automatically recompiled if any .tags in .jars are changed.  So you need to 
purge work in either case.  
A proper fix would be to check dependencies properly, at least to the .jar 
file itself.  
But the current fix is *much* better that the existing behavior.

There are better solutions, but an 80% solution is better than no solution.


// Tomcat 6.0.10 Src deployed version.

public class JspCompilationContext {...

    public void compile() throws JasperException, FileNotFoundException {
        createCompiler();

        // ------------ begin AJB
        // Hack to stop .tag files that are packaged in .jars being recompiled 
for every single .jsp that uses them.
        // The hack means that .tag files will not be automatically recompiled 
if they change -- you need to delete work area.
        // But that was actually an existing bug -- .jsps are not dependent on 
the .tag .jars so the work area needed deleting anyway.
        // (Outstanding is to compile multiple .tags in one pass and so make 
the process Much faster.)
        boolean outDated;
        if (isPackagedTagFile) outDated = ! new File(getClassFileName()).exists
();
        else outDated = jspCompiler.isOutDated();
//        AjbLog.log("### Compiler.compile " + jspUri + " pkgTagFile " + 
isPackagedTagFile + " outDated " + outDated + " " + getClassFileName());
        if (outDated) {
//     if (isPackagedTagFile || jspCompiler.isOutDated()) { // original code.
//     ---------------- end AJB
            try {
                jspCompiler.removeGeneratedFiles();
                jspLoader = null;
                jspCompiler.compile();
                jsw.setReload(true);
                jsw.setCompilationException(null);
            } catch (JasperException ex) {
                // Cache compilation exception
                jsw.setCompilationException(ex);
                throw ex;
            } catch (Exception ex) {
                JasperException je = new JasperException(
                            Localizer.getMessage("jsp.error.unable.compile"),
                            ex);
                // Cache compilation exception
                jsw.setCompilationException(je);
                throw je;
            }
        }
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to