CXFBusLifeCycleManager will call the preshutdown twice if when the 
BusApplicationContext is closed
--------------------------------------------------------------------------------------------------

                 Key: CXF-3214
                 URL: https://issues.apache.org/jira/browse/CXF-3214
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.3.1, 2.2.12, 2.2.11, 2.3.0, 2.2.10, 2.0.13, 2.1.10
            Reporter: Willem Jiang
            Assignee: Willem Jiang
            Priority: Minor
             Fix For: 2.3.2, 2.2.13, 2.4


When I write the test of BusApplicationListenerTest I found the 
BusLifeCycleListener will be called twice when the application context is 
closed.
The code of CXFBusLifeCycleManager should be changed like this
{code}
--- 
rt/core/src/main/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManager.java   
    (revision 1051771)
+++ 
rt/core/src/main/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManager.java   
    (working copy)
@@ -78,9 +78,11 @@
     
     public void preShutdown() {
         // TODO inverse order of registration?
-        preShutdownCalled = true;
-        for (BusLifeCycleListener listener : listeners) {
-            listener.preShutdown();
+        if (!preShutdownCalled) { 
+            preShutdownCalled = true;
+            for (BusLifeCycleListener listener : listeners) {
+                listener.preShutdown();
+            }
         }
     }

{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to