tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r616563 - in /tomcat/trunk/java/org/apache/jasper: JspCompilationContext.java compiler/JspRuntimeContext.java
Date Tue, 29 Jan 2008 23:37:14 GMT
Author: markt
Date: Tue Jan 29 15:37:08 2008
New Revision: 616563

URL: http://svn.apache.org/viewvc?rev=616563&view=rev
Log:
Better fix for 43878. If we aren't re-loading, use a single class loader for JSPs and tag
files to reduce perm gen space usage

Modified:
    tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java

Modified: tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java?rev=616563&r1=616562&r2=616563&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/JspCompilationContext.java Tue Jan 29 15:37:08 2008
@@ -34,7 +34,6 @@
 import org.apache.jasper.compiler.JspUtil;
 import org.apache.jasper.compiler.Localizer;
 import org.apache.jasper.compiler.ServletWriter;
-import org.apache.jasper.servlet.JasperLoader;
 import org.apache.jasper.servlet.JspServletWrapper;
 
 /**
@@ -176,11 +175,7 @@
 
     public ClassLoader getJspLoader() {
         if( jspLoader == null ) {
-            jspLoader = new JasperLoader
-            (new URL[] {baseUrl},
-                    getClassLoader(),
-                    rctxt.getPermissionCollection(),
-                    rctxt.getCodeSource());
+            jspLoader = rctxt.getJspLoader(baseUrl, getClassLoader());
         }
         return jspLoader;
     }

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=616563&r1=616562&r2=616563&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Tue Jan 29 15:37:08
2008
@@ -38,6 +38,7 @@
 import org.apache.jasper.Options;
 import org.apache.jasper.runtime.JspFactoryImpl;
 import org.apache.jasper.security.SecurityClassLoad;
+import org.apache.jasper.servlet.JasperLoader;
 import org.apache.jasper.servlet.JspServletWrapper;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -155,6 +156,7 @@
     private ServletContext context;
     private Options options;
     private URLClassLoader parentClassLoader;
+    private JasperLoader jspLoader;
     private PermissionCollection permissionCollection;
     private CodeSource codeSource;                    
     private String classpath;
@@ -314,6 +316,26 @@
      */
     public String getClassPath() {
         return classpath;
+    }
+
+
+    /**
+     * Obtain the classloader to use when loading JSP resources. In development
+     * mode or when running background compilations, each JSP has a separate
+     * classloader to enable easy re-loading of modified JSPs. If not in
+     * development mode, a single loader is used to reduce perm gen usage when
+     * many JSPs all use the same handful of tags.
+     */
+    public URLClassLoader getJspLoader(URL baseUrl, ClassLoader parent) {
+        if (options.getDevelopment() || lastCheck > -1) {
+            return new JasperLoader(new URL[] {baseUrl}, parent,
+                    permissionCollection, codeSource);
+        }
+        if (jspLoader == null) {
+            jspLoader = new JasperLoader(new URL[] {baseUrl}, parent,
+                    permissionCollection, codeSource);
+        }
+        return jspLoader;
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message