Clean-up post init/destroy lifecycle refactoring
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 14:25:42 +0000 (14:25 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 14:25:42 +0000 (14:25 +0000)
By default, remove children on destroy, not stop

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@940236 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ContainerBase.java

index 476e8b9..d6dff03 100644 (file)
@@ -1022,11 +1022,6 @@ public abstract class ContainerBase extends LifecycleBase
         for (int i = 0; i < children.length; i++) {
             children[i].stop();
         }
-        // Remove children - so next start can work
-        children = findChildren();
-        for (int i = 0; i < children.length; i++) {
-            removeChild(children[i]);
-        }
 
         // Stop our subordinate components, if any
         if ((resources != null) && (resources instanceof Lifecycle)) {
@@ -1094,6 +1089,11 @@ public abstract class ContainerBase extends LifecycleBase
     @Override
     protected void destroyInternal() throws LifecycleException {
 
+        // Remove children now this container is being destroyed
+        for (Container child : findChildren()) {
+            child.destroy();
+        }
+
         // unregister this component
         if ( oname != null ) {
             try {