From: markt false. If not specified, the default value of
+ * false will be used.
+ */
+ private boolean clearReferencesStatic = false;
+
// ----------------------------------------------------- Context Properties
@@ -2069,6 +2078,32 @@ public class StandardContext
}
+ /**
+ * Return the clearReferencesStatic flag for this Context.
+ */
+ public boolean getClearReferencesStatic() {
+
+ return (this.clearReferencesStatic);
+
+ }
+
+
+ /**
+ * Set the clearReferencesStatic feature for this Context.
+ *
+ * @param clearReferencesStatic The new flag value
+ */
+ public void setClearReferencesStatic(boolean clearReferencesStatic) {
+
+ boolean oldClearReferencesStatic = this.clearReferencesStatic;
+ this.clearReferencesStatic = clearReferencesStatic;
+ support.firePropertyChange("clearReferencesStatic",
+ oldClearReferencesStatic,
+ this.clearReferencesStatic);
+
+ }
+
+
// -------------------------------------------------------- Context Methods
diff --git a/java/org/apache/catalina/loader/WebappClassLoader.java b/java/org/apache/catalina/loader/WebappClassLoader.java
index ef891427d..2b0f546ef 100644
--- a/java/org/apache/catalina/loader/WebappClassLoader.java
+++ b/java/org/apache/catalina/loader/WebappClassLoader.java
@@ -119,9 +119,6 @@ public class WebappClassLoader
private static final Listfalse. If not specified, the default value of
+ * false will be used.
+ */
+ private boolean clearReferencesStatic = false;
+
// ------------------------------------------------------------- Properties
@@ -564,6 +572,25 @@ public class WebappClassLoader
parent = pcl;
}
+ /**
+ * Return the clearReferencesStatic flag for this Context.
+ */
+ public boolean getClearReferencesStatic() {
+ return (this.clearReferencesStatic);
+ }
+
+
+ /**
+ * Set the clearReferencesStatic feature for this Context.
+ *
+ * @param clearReferencesStatic The new flag value
+ */
+ public void setClearReferencesStatic(boolean clearReferencesStatic) {
+ this.clearReferencesStatic = clearReferencesStatic;
+ }
+
+
+
// ------------------------------------------------------- Reloader Methods
@@ -1653,7 +1680,7 @@ public class WebappClassLoader
// Null out any static or final fields from loaded classes,
// as a workaround for apparent garbage collection bugs
- if (ENABLE_CLEAR_REFERENCES) {
+ if (clearReferencesStatic) {
clearReferencesStaticFinal();
}
diff --git a/java/org/apache/catalina/loader/WebappLoader.java b/java/org/apache/catalina/loader/WebappLoader.java
index 6d1d59544..58367e90a 100644
--- a/java/org/apache/catalina/loader/WebappLoader.java
+++ b/java/org/apache/catalina/loader/WebappLoader.java
@@ -637,8 +637,13 @@ public class WebappLoader
classLoader = createClassLoader();
classLoader.setResources(container.getResources());
classLoader.setDelegate(this.delegate);
- if (container instanceof StandardContext)
- classLoader.setAntiJARLocking(((StandardContext) container).getAntiJARLocking());
+ if (container instanceof StandardContext) {
+ classLoader.setAntiJARLocking(
+ ((StandardContext) container).getAntiJARLocking());
+ classLoader.setClearReferencesStatic(
+ ((StandardContext) container).getClearReferencesStatic());
+
+ }
for (int i = 0; i < repositories.length; i++) {
classLoader.addRepository(repositories[i]);
diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml
index 96239e70f..e79d8ad97 100644
--- a/webapps/docs/config/context.xml
+++ b/webapps/docs/config/context.xml
@@ -328,6 +328,17 @@
of the flag is true.
If true, Tomcat attempts to null out any static or final
+ fields from loaded classes when a web application is stopped as a work
+ around for apparent garbage collection bugs and application coding
+ errors. There have been some issues reported with log4j when this
+ is true. Applications without memory leaks using recent
+ JVMs should operate correctly with this attribute set to
+ false. If not specified, the default value of
+ false will be used.
Whether the context should process TLDs on startup. The default is true. The false setting is intended for special cases diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index 06f05637c..7a43ba025 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -403,20 +403,6 @@ configured on the Engine element.
-If true, Tomcat attempts to null out any static or final
- fields from loaded classes when a web application is stopped as a work
- around for apparent garbage collection bugs and application coding errors.
-
There have been some issues reported with log4j when this option is
- true.
Applications without memory leaks using recent JVMs should operate
- correctly with this option set to false.
If not specified, the default value of true will be used.
-
The URL for the catalina.properties configuration file.