remm 01/06/23 14:55:39
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java
Log:
- Reset the Jasper class loader when reloading, so that a new one will be
created. Jasper was always using the old (destroyed) CL before.
- Make the work directory attribute a protected attribute (since its value will
never have to change). That protects it when clearing the attributes during a
reload (before, the CL setup was failing after a reload because it couldn't find
the work attribute).
- Cleaned up a bit the binding / unbing order. Before, the old CL was still
bound when reloading the classes for the listeners. This shouldn't have
any real world effect, but it still is more correct this way.
Revision Changes Path
1.66 +36 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- StandardContext.java 2001/06/23 19:50:30 1.65
+++ StandardContext.java 2001/06/23 21:55:39 1.66
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.65 2001/06/23 19:50:30 craigmcc Exp $
- * $Revision: 1.65 $
- * $Date: 2001/06/23 19:50:30 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.66 2001/06/23 21:55:39 remm Exp $
+ * $Revision: 1.66 $
+ * $Date: 2001/06/23 21:55:39 $
*
* ====================================================================
*
@@ -141,7 +141,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.65 $ $Date: 2001/06/23 19:50:30 $
+ * @version $Revision: 1.66 $ $Date: 2001/06/23 21:55:39 $
*/
public class StandardContext
@@ -2305,8 +2305,8 @@
}
// Clear all application-originated servlet context attributes
- // if (context != null)
- // context.clearAttributes();
+ if (context != null)
+ context.clearAttributes();
// Shut down filters and application event listeners
filterStop();
@@ -2321,6 +2321,12 @@
}
}
+ // Binding thread
+ unbindThread();
+
+ // Dump the old Jasper loader
+ jasperLoader = null;
+
// Shut down our application class loader
if ((loader != null) && (loader instanceof Lifecycle)) {
try {
@@ -2352,6 +2358,18 @@
}
}
+ // Binding thread
+ bindThread();
+
+ ClassLoader oldCtxClassLoader =
+ Thread.currentThread().getContextClassLoader();
+ ClassLoader classLoader = loader.getClassLoader();
+
+ // Set the context class loader
+ if (classLoader != null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+
// Restart our session manager (AFTER naming context recreated/bound)
if ((manager != null) && (manager instanceof Lifecycle)) {
try {
@@ -2375,6 +2393,11 @@
}
}
+ // Set the context class loader to the old class loader
+ if (classLoader != null) {
+ Thread.currentThread().setContextClassLoader(oldCtxClassLoader);
+ }
+
// Restart our currently defined servlets
for (int i = 0; i < children.length; i++) {
if (!ok)
@@ -3329,6 +3352,9 @@
// Unbinding thread
unbindThread();
+ // Dump the old Jasper loader
+ jasperLoader = null;
+
if (debug >= 1)
log("Stopping complete");
@@ -3769,7 +3795,10 @@
// Set the appropriate servlet context attribute
getServletContext().setAttribute(Globals.WORK_DIR_ATTR, dir);
-
+ if (getServletContext() instanceof ApplicationContext)
+ ((ApplicationContext) getServletContext()).setAttributeReadOnly
+ (Globals.WORK_DIR_ATTR);
+
}