cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1244663 - in /cxf/branches/2.5.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/spring/ systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/
Date Wed, 15 Feb 2012 19:21:21 GMT
Author: dkulp
Date: Wed Feb 15 19:21:21 2012
New Revision: 1244663

URL: http://svn.apache.org/viewvc?rev=1244663&view=rev
Log:
Merged revisions 1244652 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1244652 | dkulp | 2012-02-15 14:13:05 -0500 (Wed, 15 Feb 2012) | 1 line
  
  [CXF-4094] Put a guard around the closing of the context.
........

Added:
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/basic.xml
      - copied unchanged from r1244652, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/basic.xml
Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
    cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
    cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java

Propchange: cxf/branches/2.5.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1244663&r1=1244662&r2=1244663&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
Wed Feb 15 19:21:21 2012
@@ -47,7 +47,7 @@ public class SpringBus extends Extension
     implements ApplicationContextAware, ApplicationListener {
 
     AbstractApplicationContext ctx;
-
+    boolean closeContext;
     
     public SpringBus() {
     }
@@ -115,7 +115,6 @@ public class SpringBus extends Extension
             }
             ac = ac.getParent();
         }
-        
         if (doIt) {
             if (event instanceof ContextRefreshedEvent) {
                 if (getState() != BusState.RUNNING) {
@@ -128,7 +127,9 @@ public class SpringBus extends Extension
     }
     
     public void destroyBeans() {
-        ctx.close();
+        if (closeContext) {
+            ctx.close();
+        }
         super.destroyBeans();
     }
     
@@ -148,4 +149,8 @@ public class SpringBus extends Extension
         return id;
     }
 
+    public void setCloseContext(boolean b) {
+        closeContext = b;
+    }
+
 }

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?rev=1244663&r1=1244662&r2=1244663&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
Wed Feb 15 19:21:21 2012
@@ -83,6 +83,10 @@ public class SpringBusFactory extends Bu
         initializeBus(bus);        
         
         registerApplicationContextLifeCycleListener(bus, bac);
+        
+        if (bus instanceof SpringBus && defaultBusNotExists()) {
+            ((SpringBus)bus).setCloseContext(true);
+        }
         return bus;
     }
     

Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java?rev=1244663&r1=1244662&r2=1244663&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java
Wed Feb 15 19:21:21 2012
@@ -64,6 +64,19 @@ public class SpringBusFactoryTest extend
         checkBindingExtensions(bus);
         checkHTTPTransportFactories(bus);
         checkOtherCoreExtensions(bus);
+        ctx.destroy();
+    }
+    @Test
+    public void testLoadBusWithApplicationContext() throws BusException {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/systest/bus/basic.xml"});
+        Bus bus = ctx.getBean("cxf", Bus.class);
+        ctx.refresh();
+        bus = ctx.getBean("cxf", Bus.class);
+        checkBindingExtensions(bus);
+        checkHTTPTransportFactories(bus);
+        checkOtherCoreExtensions(bus);
+        ctx.destroy();
     }
     
     private void checkBindingExtensions(Bus bus) throws BusException {



Mime
View raw message