activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r376040 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java
Date Wed, 08 Feb 2006 20:06:20 GMT
Author: chirino
Date: Wed Feb  8 12:06:18 2006
New Revision: 376040

URL: http://svn.apache.org/viewcvs?rev=376040&view=rev
Log:
use service stopper to simplify stop() method

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java?rev=376040&r1=376039&r2=376040&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java
Wed Feb  8 12:06:18 2006
@@ -23,6 +23,7 @@
 import org.apache.activemq.command.DiscoveryEvent;
 import org.apache.activemq.transport.CompositeTransport;
 import org.apache.activemq.transport.TransportFilter;
+import org.apache.activemq.util.ServiceStopper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -59,21 +60,10 @@
     }
 
     public void stop() throws Exception {
-        IOException firstError = null;
-        try {
-            discoveryAgent.stop();
-        } catch (IOException e) {
-            firstError = e;
-        }
-        try {
-            next.stop();
-        } catch (IOException e) {
-            if (firstError != null)
-                firstError = e;
-        }
-        if (firstError != null) {
-            throw firstError;
-        }
+    	ServiceStopper ss = new ServiceStopper();
+    	ss.stop(discoveryAgent);
+    	ss.stop(next);
+    	ss.throwFirstException();
     }
 
     public void onServiceAdd(DiscoveryEvent event) {



Mime
View raw message