Author: markt
Date: Tue Aug 31 17:52:45 2010
New Revision: 991274
URL: http://svn.apache.org/viewvc?rev=991274&view=rev
Log:
Some Lifecycle clean-up
Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=991274&r1=991273&r2=991274&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Tue Aug 31
17:52:45 2010
@@ -956,7 +956,13 @@ public abstract class ContainerBase exte
fireContainerEvent(REMOVE_CHILD_EVENT, child);
- // child.setParent(null);
+ // Set child's parent to null to prevent a loop
+ child.setParent(null);
+ try {
+ child.destroy();
+ } catch (LifecycleException e) {
+ log.error("ContainerBase.removeChild: destroy: ", e);
+ }
}
@@ -1091,9 +1097,10 @@ public abstract class ContainerBase exte
// Remove children now this container is being destroyed
for (Container child : findChildren()) {
- child.destroy();
+ removeChild(child);
}
+ // Required if the child is destroyed directly.
if (parent != null) {
parent.removeChild(this);
}
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=991274&r1=991273&r2=991274&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Tue Aug 31
17:52:45 2010
@@ -58,7 +58,6 @@ import org.apache.catalina.Globals;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
-import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Pipeline;
import org.apache.catalina.Valve;
@@ -931,12 +930,6 @@ public class ContextConfig
Container[] children = context.findChildren();
for (i = 0; i < children.length; i++) {
context.removeChild(children[i]);
- try {
- children[i].destroy();
- } catch (LifecycleException e) {
- log.warn(sm.getString("contentConfig.destroyChildFailed",
- children[1].getName(), context.getName()), e);
- }
}
// Removing application parameters
Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=991274&r1=991273&r2=991274&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Tue
Aug 31 17:52:45 2010
@@ -35,7 +35,6 @@ contextConfig.defaultError=Error process
contextConfig.defaultMissing=No global web.xml found
contextConfig.defaultPosition=Occurred at line {0} column {1}
contextConfig.destroy=ContextConfig: Destroying
-contentConfig.destroyChildFailed=Failed to destroy child [{0}] of context [{1}]
contextConfig.fileUrl=Unable to create a File object from the URL [{0}]
contextConfig.fixDocBase=Exception fixing docBase for context [{0}]
contextConfig.init=ContextConfig: Initializing
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=991274&r1=991273&r2=991274&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug 31 17:52:45 2010
@@ -97,6 +97,11 @@
de-register the web application's Servlets with the MBean server.
(markt)
</fix>
+ <update>
+ More tweaks to the Lifecycle refactoring to ensure that when a
component
+ is being destroyed, the destroy method is only called once on each
+ child component. (markt)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]