cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [3/3] git commit: Do the destroy in reverse order of the start so anything that may have required stuff from setup can still use it for cleanup
Date Fri, 14 Mar 2014 18:19:14 GMT
Do the destroy in reverse order of the start so anything that may have required stuff from
setup can still use it for cleanup


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a5466488
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5466488
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5466488

Branch: refs/heads/master
Commit: a5466488bec01b3aaa136808198d14447717e42c
Parents: eabac92
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Mar 14 14:15:58 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Mar 14 14:19:01 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/bus/managers/CXFBusLifeCycleManager.java | 12 ++++++++----
 .../cxf/bus/managers/ClientLifeCycleManagerImpl.java    |  6 ++++--
 .../cxf/bus/managers/ServerLifeCycleManagerImpl.java    |  7 ++++---
 .../cxf/buslifecycle/CXFBusLifeCycleManagerTest.java    |  4 ++--
 4 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a5466488/core/src/main/java/org/apache/cxf/bus/managers/CXFBusLifeCycleManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/managers/CXFBusLifeCycleManager.java b/core/src/main/java/org/apache/cxf/bus/managers/CXFBusLifeCycleManager.java
index d742696..50c0be0 100644
--- a/core/src/main/java/org/apache/cxf/bus/managers/CXFBusLifeCycleManager.java
+++ b/core/src/main/java/org/apache/cxf/bus/managers/CXFBusLifeCycleManager.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.bus.managers;
 
+import java.util.ListIterator;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.annotation.Resource;
@@ -91,8 +92,9 @@ public class CXFBusLifeCycleManager implements BusLifeCycleManager {
     public void preShutdown() {
         if (!preShutdownCalled) { 
             preShutdownCalled = true;
-            for (BusLifeCycleListener listener : listeners) {
-                listener.preShutdown();
+            ListIterator<BusLifeCycleListener> li = listeners.listIterator(listeners.size());
+            while (li.hasPrevious()) {
+                li.previous().preShutdown();
             }
         }
     }
@@ -103,9 +105,11 @@ public class CXFBusLifeCycleManager implements BusLifeCycleManager {
         }
         if (!postShutdownCalled) {
             postShutdownCalled = true;
-            for (BusLifeCycleListener listener : listeners) {
-                listener.postShutdown();
+            ListIterator<BusLifeCycleListener> li = listeners.listIterator(listeners.size());
+            while (li.hasPrevious()) {
+                li.previous().postShutdown();
             }
+
         }
     }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5466488/core/src/main/java/org/apache/cxf/bus/managers/ClientLifeCycleManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/managers/ClientLifeCycleManagerImpl.java
b/core/src/main/java/org/apache/cxf/bus/managers/ClientLifeCycleManagerImpl.java
index efddd30..b609ffd 100644
--- a/core/src/main/java/org/apache/cxf/bus/managers/ClientLifeCycleManagerImpl.java
+++ b/core/src/main/java/org/apache/cxf/bus/managers/ClientLifeCycleManagerImpl.java
@@ -20,6 +20,7 @@
 package org.apache.cxf.bus.managers;
 
 import java.util.Collection;
+import java.util.ListIterator;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.cxf.Bus;
@@ -63,8 +64,9 @@ public class ClientLifeCycleManagerImpl implements ClientLifeCycleManager,
BusEx
     }
 
     public void clientDestroyed(Client client) {
-        for (ClientLifeCycleListener listener : listeners) {
-            listener.clientDestroyed(client);
+        ListIterator<ClientLifeCycleListener> li = listeners.listIterator(listeners.size());
+        while (li.hasPrevious()) {
+            li.previous().clientDestroyed(client);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5466488/core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java
b/core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java
index 3a69239..efdd1a5 100644
--- a/core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java
+++ b/core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java
@@ -20,7 +20,7 @@
 package org.apache.cxf.bus.managers;
 
 import java.util.Collection;
-
+import java.util.ListIterator;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.cxf.Bus;
@@ -63,8 +63,9 @@ public class ServerLifeCycleManagerImpl implements ServerLifeCycleManager,
BusEx
     }
 
     public void stopServer(Server server) {
-        for (ServerLifeCycleListener listener : listeners) {
-            listener.stopServer(server);
+        ListIterator<ServerLifeCycleListener> li = listeners.listIterator(listeners.size());
+        while (li.hasPrevious()) {
+            li.previous().stopServer(server);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/a5466488/core/src/test/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManagerTest.java
b/core/src/test/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManagerTest.java
index 00e3051..cd68169 100644
--- a/core/src/test/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManagerTest.java
+++ b/core/src/test/java/org/apache/cxf/buslifecycle/CXFBusLifeCycleManagerTest.java
@@ -96,15 +96,15 @@ public class CXFBusLifeCycleManagerTest extends Assert {
         ctrl.verify();
         
         ctrl.reset();
-        listener1.preShutdown();
         listener2.preShutdown();
+        listener1.preShutdown();
         ctrl.replay();
         mgr.preShutdown();
         ctrl.verify();
         
         ctrl.reset();
-        listener1.postShutdown();
         listener2.postShutdown();
+        listener1.postShutdown();
         ctrl.replay();
         mgr.postShutdown();
         ctrl.verify();


Mime
View raw message