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