cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1086958 - in /cxf/branches/2.3.x-fixes/rt/core/src: main/java/org/apache/cxf/bus/spring/BusApplicationListener.java test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java
Date Wed, 30 Mar 2011 14:04:41 GMT
Author: ningjiang
Date: Wed Mar 30 14:04:40 2011
New Revision: 1086958

URL: http://svn.apache.org/viewvc?rev=1086958&view=rev
Log:
CXF-3428 Fixed the issue of Context closed twice with Spring setup

Modified:
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
    cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java?rev=1086958&r1=1086957&r2=1086958&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationListener.java
Wed Mar 30 14:04:40 2011
@@ -62,11 +62,12 @@ public class BusApplicationListener impl
                     ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
                             BusLifeCycleManager.class);
                 lcm.initComplete();
-            } else if (event instanceof ContextClosedEvent) {
-                BusLifeCycleManager lcm = (BusLifeCycleManager)
-                    ctx.getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager",
-                        BusLifeCycleManager.class);
+            } else if (event instanceof ContextClosedEvent && ctx.isActive()) {
+                // To avoid the ctx to be closed twice
+                BusLifeCycleManager lcm = (BusLifeCycleManager)ctx
+                    .getBean("org.apache.cxf.buslifecycle.BusLifeCycleManager", BusLifeCycleManager.class);
                 lcm.postShutdown();
+
             }
         }
     }

Modified: cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java?rev=1086958&r1=1086957&r2=1086958&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationListenerTest.java
Wed Mar 30 14:04:40 2011
@@ -46,6 +46,9 @@ public class BusApplicationListenerTest 
         listener.postShutdown();
         EasyMock.expectLastCall().times(1);
         EasyMock.replay(listener);
+        AbstractRefreshableApplicationContext context = 
+            (AbstractRefreshableApplicationContext)factory.getApplicationContext();
+        context.close();
         parent.close();
         EasyMock.verify(listener);
     }



Mime
View raw message