> From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> Subject: Re: How to hot swap classes?
> 
> Did you mean "a separate ClassLoader for all the JSPs"?

Not quite, but what I said was incomplete.  From looking at the code, it 
appears that each context gets its own instance of JasperLoader (a subclass of 
URLClassLoader) when the first JSP for the context is referenced.  That 
classloader will continue to be used until a previously compiled but now 
updated JSP is encountered.  At that point, the existing JasperLoader for the 
context is discarded, and a new one created.  The following code is in 
JspCompilationContext.java, at line 580 in 6.0.18:

    public void compile() throws JasperException, FileNotFoundException {
        createCompiler();
        if (jspCompiler.isOutDated()) {
            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;
            }
        }
    }

The new instance of JasperLoader is created by the method getJspLoader() at 
line 177 of the same file.  Note that your grep would not have found the 
JasperLoader due to its not using ClassLoader in its name.

Also, the JSP classloaders do not seem to appear in any JMX objects, 
unfortunately.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

Reply via email to