You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2009/01/08 11:04:51 UTC

svn commit: r732671 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java

Author: vamsic007
Date: Thu Jan  8 02:04:50 2009
New Revision: 732671

URL: http://svn.apache.org/viewvc?rev=732671&view=rev
Log:
1. Add a context to host only it has not already been added.
2. Destroy the context once it is stopped.

Modified:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java?rev=732671&r1=732670&r2=732671&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java (original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-http-tomcat/src/main/java/org/apache/geronimo/tuscany/http/tomcat/GeronimoServletHost.java Thu Jan  8 02:04:50 2009
@@ -139,7 +139,9 @@
         }
         
         context = (StandardContext)((StandardHost)host).map(contextPath);
+        boolean newContext = false;
         if(context == null || context.getName().equals("")) {
+            newContext = true;
             context = new StandardContext();
             context.setDocBase(docext + contextPath);
             context.setJ2EEApplication(JMX_APP_NAME); // FIXME: Different name
@@ -180,7 +182,9 @@
         if(!temp.exists()) {
             temp.mkdirs();
         }
-        host.addChild(context);        
+        if(newContext) {
+            host.addChild(context);
+        }
         try {
             context.start();
         } catch (LifecycleException e) {
@@ -209,8 +213,9 @@
         if(context.findChildren().length < 3 && !context.getName().equals("")){
             try{        
                 ((StandardContext)context).stop();
-            }catch(LifecycleException lfe){
-                log.fatal("The context named " + context.getName() + " failed to stop",lfe);
+                ((StandardContext)context).destroy();
+            }catch(Exception e){
+                log.fatal("The context named " + context.getName() + " failed to stop", e);
             }
             host.removeChild(context);
         }