You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jg...@apache.org on 2005/09/12 13:06:53 UTC

svn commit: r280321 - /geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java

Author: jgenender
Date: Mon Sep 12 04:06:48 2005
New Revision: 280321

URL: http://svn.apache.org/viewcvs?rev=280321&view=rev
Log:
Fixed the undeploy of webcontexts - ensured proper destruction of the context.

Modified:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=280321&r1=280320&r2=280321&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java Mon Sep 12 04:06:48 2005
@@ -27,6 +27,7 @@
 import org.apache.catalina.Engine;
 import org.apache.catalina.Realm;
 import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.realm.JAASRealm;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -41,6 +42,8 @@
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
 
+
+
 /**
  * Apache Tomcat GBean
  *
@@ -169,6 +172,7 @@
             embedded.stop();
             embedded = null;
         }
+        
     }
 
     /**
@@ -266,8 +270,19 @@
     public void removeContext(TomcatContext ctx) {
         Context context = ctx.getContext();
 
-        if (context != null)
-            embedded.removeContext(context);
+        if (context != null){
+            if (context instanceof StandardContext){
+                StandardContext stdctx = (StandardContext)context;
+                try{
+                    stdctx.stop();
+                    stdctx.destroy();
+                } catch (Exception e){
+                    throw new RuntimeException(e);
+                }
+
+            }
+            context.getParent().removeChild(context);
+        }
 
     }
 
@@ -305,11 +320,12 @@
     public void removeWebService(String contextPath) {
         TomcatEJBWebServiceContext context = (TomcatEJBWebServiceContext) webServices.get(contextPath);
         try{
+            context.stop();
             context.destroy();
         } catch (Exception e){
             throw new RuntimeException(e);
         }
-        embedded.removeContext(context);
+        context.getParent().removeChild(context);
         webServices.remove(contextPath);
     }