cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1559985 - in /cxf/trunk/core/src: main/java/org/apache/cxf/bus/spring/SpringBus.java test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java
Date Tue, 21 Jan 2014 11:46:33 GMT
Author: ningjiang
Date: Tue Jan 21 11:46:32 2014
New Revision: 1559985

URL: http://svn.apache.org/r1559985
Log:
CXF-5505 SpringBus should shutdown the bus when the application context is closed

Modified:
    cxf/trunk/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
    cxf/trunk/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java

Modified: cxf/trunk/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1559985&r1=1559984&r2=1559985&view=diff
==============================================================================
--- cxf/trunk/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java (original)
+++ cxf/trunk/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java Tue Jan 21 11:46:32
2014
@@ -20,7 +20,6 @@
 package org.apache.cxf.bus.spring;
 
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.buslifecycle.BusLifeCycleManager;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
@@ -108,8 +107,10 @@ public class SpringBus extends Extension
                 if (getState() != BusState.RUNNING) {
                     initialize();
                 }
-            } else if (event instanceof ContextClosedEvent) {
-                getExtension(BusLifeCycleManager.class).postShutdown();
+            } else if (event instanceof ContextClosedEvent && getState() == BusState.RUNNING)
{
+                // The bus could be create by using SpringBusFactory.createBus("/cxf.xml");

+                // Just to make sure the shutdown is called rightly
+                shutdown();
             }
         }
     }

Modified: cxf/trunk/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java?rev=1559985&r1=1559984&r2=1559985&view=diff
==============================================================================
--- cxf/trunk/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java (original)
+++ cxf/trunk/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java Tue Jan
21 11:46:32 2014
@@ -96,6 +96,14 @@ public class SpringBusFactoryTest extend
     }
     
     @Test
+    public void testCustomerBusShutdown() {
+        String cfgFile = "org/apache/cxf/bus/spring/customerBus.xml";
+        Bus bus = new SpringBusFactory().createBus(cfgFile, true);
+        // We have three bus here, which should be closed rightly
+        bus.shutdown(true);
+    }
+    
+    @Test
     public void testCustomFileURLFromSystemProperty() {
         URL cfgFileURL = this.getClass().getResource("resources/bus-overwrite.xml");    
   
         System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_URL, cfgFileURL.toString());



Mime
View raw message