use service stopper to simplify stop() method

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@376040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-02-08 20:06:18 +00:00
parent 49e8a803aa
commit 1b9c601975
1 changed files with 5 additions and 15 deletions

View File

@ -23,6 +23,7 @@ import java.net.URISyntaxException;
import org.apache.activemq.command.DiscoveryEvent; import org.apache.activemq.command.DiscoveryEvent;
import org.apache.activemq.transport.CompositeTransport; import org.apache.activemq.transport.CompositeTransport;
import org.apache.activemq.transport.TransportFilter; import org.apache.activemq.transport.TransportFilter;
import org.apache.activemq.util.ServiceStopper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -59,21 +60,10 @@ public class DiscoveryTransport extends TransportFilter implements DiscoveryList
} }
public void stop() throws Exception { public void stop() throws Exception {
IOException firstError = null; ServiceStopper ss = new ServiceStopper();
try { ss.stop(discoveryAgent);
discoveryAgent.stop(); ss.stop(next);
} catch (IOException e) { ss.throwFirstException();
firstError = e;
}
try {
next.stop();
} catch (IOException e) {
if (firstError != null)
firstError = e;
}
if (firstError != null) {
throw firstError;
}
} }
public void onServiceAdd(DiscoveryEvent event) { public void onServiceAdd(DiscoveryEvent event) {