You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/01/12 21:34:24 UTC

svn commit: r1230765 - in /tomcat/trunk/java/org/apache/catalina/core: ContainerBase.java StandardContext.java

Author: markt
Date: Thu Jan 12 20:34:24 2012
New Revision: 1230765

URL: http://svn.apache.org/viewvc?rev=1230765&view=rev
Log:
Move destruction of ContainerBase objects to ContainerBase to ensure
that they are destroyed.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

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=1230765&r1=1230764&r2=1230765&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Jan 12 20:34:24 2012
@@ -1195,6 +1195,20 @@ public abstract class ContainerBase exte
     @Override
     protected void destroyInternal() throws LifecycleException {
 
+        if ((manager != null) && (manager instanceof Lifecycle)) {
+            ((Lifecycle) manager).destroy();
+        }
+        Realm realm = getRealmInternal();
+        if ((realm != null) && (realm instanceof Lifecycle)) {
+            ((Lifecycle) realm).destroy();
+        }
+        if ((cluster != null) && (cluster instanceof Lifecycle)) {
+            ((Lifecycle) cluster).destroy();
+        }
+        if ((loader != null) && (loader instanceof Lifecycle)) {
+            ((Lifecycle) loader).destroy();
+        }
+
         // Stop the Valves in our pipeline (including the basic), if any
         if (pipeline instanceof Lifecycle) {
             ((Lifecycle) pipeline).destroy();

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1230765&r1=1230764&r2=1230765&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Thu Jan 12 20:34:24 2012
@@ -5450,20 +5450,6 @@ public class StandardContext extends Con
     @Override
     protected void destroyInternal() throws LifecycleException {
 
-        if ((manager != null) && (manager instanceof Lifecycle)) {
-            ((Lifecycle) manager).destroy();
-        }
-        Realm realm = getRealmInternal();
-        if ((realm != null) && (realm instanceof Lifecycle)) {
-            ((Lifecycle) realm).destroy();
-        }
-        if ((cluster != null) && (cluster instanceof Lifecycle)) {
-            ((Lifecycle) cluster).destroy();
-        }
-        if ((loader != null) && (loader instanceof Lifecycle)) {
-            ((Lifecycle) loader).destroy();
-        }
-
         // If in state NEW when destroy is called, the object name will never
         // have been set so the notification can't be created
         if (getObjectName() != null) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1230765 - in /tomcat/trunk/java/org/apache/catalina/core: ContainerBase.java StandardContext.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/1/13  <ma...@apache.org>:
> Author: markt
> Date: Thu Jan 12 20:34:24 2012
> New Revision: 1230765
>
> URL: http://svn.apache.org/viewvc?rev=1230765&view=rev
> Log:
> Move destruction of ContainerBase objects to ContainerBase to ensure
> that they are destroyed.
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
>    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
>
> 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=1230765&r1=1230764&r2=1230765&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Jan 12 20:34:24 2012
> @@ -1195,6 +1195,20 @@ public abstract class ContainerBase exte
>     @Override
>     protected void destroyInternal() throws LifecycleException {
>
> +        if ((manager != null) && (manager instanceof Lifecycle)) {
> +            ((Lifecycle) manager).destroy();
> +        }
> +        Realm realm = getRealmInternal();
> +        if ((realm != null) && (realm instanceof Lifecycle)) {
> +            ((Lifecycle) realm).destroy();
> +        }
> +        if ((cluster != null) && (cluster instanceof Lifecycle)) {
> +            ((Lifecycle) cluster).destroy();
> +        }
> +        if ((loader != null) && (loader instanceof Lifecycle)) {
> +            ((Lifecycle) loader).destroy();
> +        }
> +
>         // Stop the Valves in our pipeline (including the basic), if any
>         if (pipeline instanceof Lifecycle) {
>             ((Lifecycle) pipeline).destroy();

I think valves should be destroyed first and those helper objects
second, like the order in stopInternal(). Though I understand that the
current order better matches to what happened with destroy code in
StandardContext.

>
> Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1230765&r1=1230764&r2=1230765&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Thu Jan 12 20:34:24 2012
> @@ -5450,20 +5450,6 @@ public class StandardContext extends Con
>     @Override
>     protected void destroyInternal() throws LifecycleException {
>
> -        if ((manager != null) && (manager instanceof Lifecycle)) {
> -            ((Lifecycle) manager).destroy();
> -        }
> -        Realm realm = getRealmInternal();
> -        if ((realm != null) && (realm instanceof Lifecycle)) {
> -            ((Lifecycle) realm).destroy();
> -        }
> -        if ((cluster != null) && (cluster instanceof Lifecycle)) {
> -            ((Lifecycle) cluster).destroy();
> -        }
> -        if ((loader != null) && (loader instanceof Lifecycle)) {
> -            ((Lifecycle) loader).destroy();
> -        }
> -
>         // If in state NEW when destroy is called, the object name will never
>         // have been set so the notification can't be created
>         if (getObjectName() != null) {
>
>
>
> ---------------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org