Skip to content
Snippets Groups Projects
Commit aa09395e authored by Dan Ambrosio's avatar Dan Ambrosio
Browse files

Enhancments to rosjava/rosjava_core#237 fix. This moves shutdown...

Enhancments to rosjava/rosjava_core#237 fix. This moves shutdown responsibility to the topicParticipantManager.
parent 36c51313
No related branches found
No related tags found
No related merge requests found
...@@ -405,14 +405,7 @@ public class DefaultNode implements ConnectedNode { ...@@ -405,14 +405,7 @@ public class DefaultNode implements ConnectedNode {
// NOTE(damonkohler): We don't want to raise potentially spurious // NOTE(damonkohler): We don't want to raise potentially spurious
// exceptions during shutdown that would interrupt the process. This is // exceptions during shutdown that would interrupt the process. This is
// simply best effort cleanup. // simply best effort cleanup.
for (DefaultPublisher<?> publisher : topicParticipantManager.getPublishers()) { topicParticipantManager.shutdown();
publisher.shutdown();
topicParticipantManager.removePublisher(publisher);
}
for (DefaultSubscriber<?> subscriber : topicParticipantManager.getSubscribers()) {
subscriber.shutdown();
topicParticipantManager.removeSubscriber(subscriber);
}
for (ServiceServer<?, ?> serviceServer : serviceManager.getServers()) { for (ServiceServer<?, ?> serviceServer : serviceManager.getServers()) {
try { try {
Response<Integer> response = Response<Integer> response =
......
...@@ -136,6 +136,19 @@ public class TopicParticipantManager { ...@@ -136,6 +136,19 @@ public class TopicParticipantManager {
publisherConnections.remove(publisher, subscriberIdentifier); publisherConnections.remove(publisher, subscriberIdentifier);
} }
public void shutdown(){
for(DefaultPublisher<?> publisher : publishers.values()){
publisher.shutdown();
removePublisher(publisher);
}
subscriberConnections.clear();
for(DefaultSubscriber<?> subscriber : subscribers.values()){
subscriber.shutdown();
removeSubscriber(subscriber);
}
publisherConnections.clear();
}
public Collection<DefaultSubscriber<?>> getSubscribers() { public Collection<DefaultSubscriber<?>> getSubscribers() {
return ImmutableList.copyOf(subscribers.values()); return ImmutableList.copyOf(subscribers.values());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment