craigmcc 2002/12/17 23:39:45
Modified: src/share/org/apache/struts/action ActionServlet.java
Log:
Call the modified LogFactory.release() method that allows the LogFactory
instance, and any Log instances it has created, to be freed on a per-webapp-
class-loader basis. This is in an attempt to investigate the OutOfMemory
error reported on Bugzilla #14042. It seems to help, but memory still runs
out when you repeatedly reload a Struts webapp. Further investigation is
needed to see if this is really a container issue (tested against
Tomcat 4.1.17, which was just released).
If the LogFactory.release(ClassLoader) method gets removed, we'll need to
remove this call from the destroy() method.
Revision Changes Path
1.136 +19 -4
jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
Index: ActionServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- ActionServlet.java 8 Dec 2002 05:27:07 -0000 1.135
+++ ActionServlet.java 18 Dec 2002 07:39:45 -0000 1.136
@@ -433,6 +433,18 @@
// FIXME - destroy ModuleConfig and message resource instances
+ // Release our LogFactory and Log instances (if any)
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader == null) {
+ classLoader = ActionServlet.class.getClassLoader();
+ }
+ try {
+ LogFactory.release(classLoader);
+ } catch (Throwable t) {
+ ; // Servlet container doesn't have the latest version
+ ; // of commons-logging-api.jar installed
+ }
+
}
@@ -703,6 +715,7 @@
ModuleConfig config = (ModuleConfig) value;
try {
getRequestProcessor(config).destroy();
+ getServletContext().removeAttribute(name);
} catch (Throwable t) {
;
}
@@ -714,6 +727,8 @@
int j = plugIns.length - (i + 1);
plugIns[j].destroy();
}
+ getServletContext().removeAttribute
+ (Globals.PLUG_INS_KEY + config.getPrefix());
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>