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);
+ }
}
// 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);
}
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;
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
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
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">