* instability. As such, enabling this should be viewed as an option of last
* resort in a development environment and is not recommended in a
* production environment. If not specified, the default value of
- * <code>false</code> will be used.
+ * <code>false</code> will be used.
*/
private boolean clearReferencesStopThreads = false;
+
+ /**
+ * Should Tomcat attempt to terminate any {@link java.util.TimerThread}s
+ * that have been started by the web application? If not specified, the
+ * default value of <code>false</code> will be used.
+ */
+ private boolean clearReferencesStopTimerThreads = false;
/**
* Should Tomcat attempt to clear any ThreadLocal objects that are instances
/**
+ * Return the clearReferencesStopTimerThreads flag for this Context.
+ */
+ public boolean getClearReferencesStopTimerThreads() {
+ return (this.clearReferencesStopTimerThreads);
+ }
+
+
+ /**
+ * Set the clearReferencesStopTimerThreads feature for this Context.
+ *
+ * @param clearReferencesStopTimerThreads The new flag value
+ */
+ public void setClearReferencesStopTimerThreads(
+ boolean clearReferencesStopTimerThreads) {
+
+ boolean oldClearReferencesStopTimerThreads =
+ this.clearReferencesStopTimerThreads;
+ this.clearReferencesStopTimerThreads = clearReferencesStopTimerThreads;
+ support.firePropertyChange("clearReferencesStopTimerThreads",
+ oldClearReferencesStopTimerThreads,
+ this.clearReferencesStopTimerThreads);
+ }
+
+
+ /**
* Return the clearReferencesThreadLocals flag for this Context.
*/
public boolean getClearReferencesThreadLocals() {
* instability. As such, enabling this should be viewed as an option of last
* resort in a development environment and is not recommended in a
* production environment. If not specified, the default value of
- * <code>false</code> will be used. Note that instances of
- * java.util.TimerThread will always be terminate since a safe method exists
- * to do so.
+ * <code>false</code> will be used.
*/
private boolean clearReferencesStopThreads = false;
/**
+ * Should Tomcat attempt to terminate any {@link java.util.TimerThread}s
+ * that have been started by the web application? If not specified, the
+ * default value of <code>false</code> will be used.
+ */
+ private boolean clearReferencesStopTimerThreads = false;
+
+ /**
* Should Tomcat attempt to clear any ThreadLocal objects that are instances
* of classes loaded by this class loader. Failure to remove any such
* objects will result in a memory leak on web application stop, undeploy or
/**
+ * Return the clearReferencesStopTimerThreads flag for this Context.
+ */
+ public boolean getClearReferencesStopTimerThreads() {
+ return (this.clearReferencesStopTimerThreads);
+ }
+
+
+ /**
+ * Set the clearReferencesStopTimerThreads feature for this Context.
+ *
+ * @param clearReferencesStopTimerThreads The new flag value
+ */
+ public void setClearReferencesStopTimerThreads(
+ boolean clearReferencesStopTimerThreads) {
+ this.clearReferencesStopTimerThreads = clearReferencesStopTimerThreads;
+ }
+
+
+ /**
* Return the clearReferencesLogFactoryRelease flag for this Context.
*/
public boolean getClearReferencesLogFactoryRelease() {
}
+ /**
+ * Set the clearReferencesLogFactoryRelease feature for this Context.
+ *
+ * @param clearReferencesLogFactoryRelease The new flag value
+ */
+ public void setClearReferencesLogFactoryRelease(
+ boolean clearReferencesLogFactoryRelease) {
+ this.clearReferencesLogFactoryRelease =
+ clearReferencesLogFactoryRelease;
+ }
/**
}
- /**
- * Set the clearReferencesLogFactoryRelease feature for this Context.
- *
- * @param clearReferencesLogFactoryRelease The new flag value
- */
- public void setClearReferencesLogFactoryRelease(
- boolean clearReferencesLogFactoryRelease) {
- this.clearReferencesLogFactoryRelease =
- clearReferencesLogFactoryRelease;
- }
-
-
// ------------------------------------------------------- Reloader Methods
continue;
}
- // TimerThread is not normally visible
+ // TimerThread can be stopped safely so treat separately
if (thread.getClass().getName().equals(
- "java.util.TimerThread")) {
+ "java.util.TimerThread") &&
+ clearReferencesStopTimerThreads) {
clearReferencesStopTimerThread(thread);
continue;
}
default value of <code>false</code> will be used.</p>
</attribute>
+ <attribute name="clearReferencesStopTimerThreads" required = "false">
+ <p>If <code>true</code>, Tomcat attempts to terminate
+ <code>java.util.Timer</code>threads that have been started by the web
+ application. Unlike standard threads, timer threads can be stopped
+ safely although there may still be side-effects for the application. If
+ not specified, the default value of <code>false</code> will be used.</p>
+ </attribute>
+
<attribute name="clearReferencesThreadLocals" required="false">
<p>If <code>true</code>, Tomcat attempts to clear any ThreadLocal
objects that are instances of classes loaded by this class loader.