cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1170869 - in /cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet: CXFNonSpringServlet.java CXFServlet.java
Date Wed, 14 Sep 2011 22:20:47 GMT
Author: dkulp
Date: Wed Sep 14 22:20:47 2011
New Revision: 1170869

URL: http://svn.apache.org/viewvc?rev=1170869&view=rev
Log:
[CXF-3803] Make sure bus.shutdown is called at servlet shutdown time

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=1170869&r1=1170868&r2=1170869&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Wed Sep 14 22:20:47 2011
@@ -132,5 +132,10 @@ public class CXFNonSpringServlet extends
             }
         }
         destinationRegistry = null;
+        destroyBus();
+    }
+    
+    public void destroyBus() {
+        bus.shutdown(true);
     }
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=1170869&r1=1170868&r2=1170869&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
Wed Sep 14 22:20:47 2011
@@ -31,7 +31,9 @@ import org.springframework.web.context.s
 import org.springframework.web.context.support.XmlWebApplicationContext;
 
 public class CXFServlet extends CXFNonSpringServlet {
-
+    private boolean busCreated;
+    private XmlWebApplicationContext createdContext; 
+    
     public CXFServlet() {
     }
 
@@ -57,6 +59,7 @@ public class CXFServlet extends CXFNonSp
         if (wac != null) {
             setBus(wac.getBean("cxf", Bus.class));
         } else {
+            busCreated = true;
             setBus(BusFactory.newInstance().createBus());
         }
     }
@@ -75,6 +78,7 @@ public class CXFServlet extends CXFNonSp
                                                    ServletConfig sc,
                                                    String location) {
         XmlWebApplicationContext ctx2 = new XmlWebApplicationContext();
+        createdContext = ctx2;
         ctx2.setServletConfig(sc);
 
         Resource r = ctx2.getResource(location);
@@ -109,10 +113,20 @@ public class CXFServlet extends CXFNonSp
             }
         } else {
             ctx2.setConfigLocations(new String[] {"classpath:/META-INF/cxf/cxf.xml",
-                                                  location});            
+                                                  location});
+            createdContext = ctx2;
         }
         ctx2.refresh();
         return ctx2;
     }
+    public void destroyBus() {
+        if (busCreated) {
+            //if we created the Bus, we need to destroy it.  Otherwise, spring will handleit.
+            getBus().shutdown(true);
+        }
+        if (createdContext != null) {
+            createdContext.close();
+        }
+    }
 
 }



Mime
View raw message