Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3214

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.10, 2.0.13, 2.2.10, 2.3, 2.2.11, 2.2.12, 2.3.1
    • 2.3.2, 2.4
    • Core
    • None

    Description

      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

      --- 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();
      +            }
               }
           }
      
      

      Attachments

        Activity

          People

            njiang Willem Jiang
            njiang Willem Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: