/**
* Attribute value used to turn on/off XML validation
*/
- private boolean tldValidation = false;
+ private boolean tldValidation = false;
/**
* Attribute value used to turn on/off TLD XML namespace validation
*/
- private boolean tldNamespaceAware = false;
+ private boolean tldNamespaceAware = false;
/**
*/
private JarScanner jarScanner = null;
-
-
+ /**
+ * Should Tomcat attempt 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 <code>false</code>. If not specified, the default value of
+ * <code>false</code> will be used.
+ */
+ private boolean clearReferencesStatic = false;
+
// ----------------------------------------------------- Context Properties
}
+ /**
+ * 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
private static final List<String> JVM_THREAD_GROUP_NAMES =
new ArrayList<String>();
- public static final boolean ENABLE_CLEAR_REFERENCES =
- Boolean.valueOf(System.getProperty("org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES", "true")).booleanValue();
-
static {
JVM_THREAD_GROUP_NAMES.add("system");
JVM_THREAD_GROUP_NAMES.add("RMI Runtime");
protected Permission allPermission = new java.security.AllPermission();
+ /**
+ * Should Tomcat attempt 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 <code>false</code>. If not specified, the default value of
+ * <code>false</code> will be used.
+ */
+ private boolean clearReferencesStatic = false;
+
// ------------------------------------------------------------- Properties
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
// 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();
}
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]);
of the flag is <code>true</code>.</p>
</attribute>
+ <attribute name="clearReferencesStatic" required = "false">
+ <p>If <code>true</code>, 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 <code>true</code>. Applications without memory leaks using recent
+ JVMs should operate correctly with this attribute set to
+ <code>false</code>. If not specified, the default value of
+ <code>false</code> will be used.</p>
+ </attribute>
+
<attribute name="processTlds" required="false">
<p>Whether the context should process TLDs on startup. The default
is true. The false setting is intended for special cases
configured on the <a href="engine.html">Engine</a> element.</p>
</property>
- <property
- name="org.apache.catalina.loader. WebappClassLoader.ENABLE_CLEAR_REFERENCES">
- <p>If <code>true</code>, 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.
- </p>
- <p>There have been some issues reported with log4j when this option is
- <code>true</code>.</p>
- <p>Applications without memory leaks using recent JVMs should operate
- correctly with this option set to <code>false</code>.</p>
- <p>If not specified, the default value of <code>true</code> will be used.
- </p>
- </property>
-
<property name="catalina.config">
<p>The URL for the catalina.properties configuration file.</p>
</property>