incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r983940 - in /sling/trunk/bundles/scripting/jsp: pom.xml src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
Date Tue, 10 Aug 2010 11:43:45 GMT
Author: cziegeler
Date: Tue Aug 10 11:43:45 2010
New Revision: 983940

URL: http://svn.apache.org/viewvc?rev=983940&view=rev
Log:
SLING-1638 : Reload jsp if used classloader is invalid

Modified:
    sling/trunk/bundles/scripting/jsp/pom.xml
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java

Modified: sling/trunk/bundles/scripting/jsp/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/pom.xml?rev=983940&r1=983939&r2=983940&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/pom.xml (original)
+++ sling/trunk/bundles/scripting/jsp/pom.xml Tue Aug 10 11:43:45 2010
@@ -122,7 +122,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.classloader</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.5-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
 

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java?rev=983940&r1=983939&r2=983940&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
(original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
Tue Aug 10 11:43:45 2010
@@ -35,6 +35,7 @@ import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.scripting.ScriptEvaluationException;
+import org.apache.sling.commons.classloader.DynamicClassLoader;
 import org.apache.sling.scripting.jsp.jasper.JasperException;
 import org.apache.sling.scripting.jsp.jasper.JspCompilationContext;
 import org.apache.sling.scripting.jsp.jasper.Options;
@@ -77,7 +78,7 @@ public class JspServletWrapper {
     private ServletConfig config;
     private Options options;
     private boolean firstTime = true;
-    private boolean reload = true;
+    private volatile boolean reload = true;
     private boolean isTagFile;
     private int tripCount;
     private JasperException compileException;
@@ -131,6 +132,12 @@ public class JspServletWrapper {
     public Servlet getServlet()
         throws ServletException, IOException, FileNotFoundException
     {
+        // check if the used class loader is still alive
+        if (!reload) {
+            if ( servletClass.getClassLoader() instanceof DynamicClassLoader ) {
+                reload = !((DynamicClassLoader)servletClass.getClassLoader()).isLive();
+            }
+        }
         if (reload) {
             synchronized (this) {
                 // Synchronizing on jsw enables simultaneous loading



Mime
View raw message