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

This fixes rosjava/rosjava_core#237. Added fix to remove Publishers and...

This fixes rosjava/rosjava_core#237. Added fix to remove Publishers and Subscribers from topicParticipantManager on node shutdown. Added fix to remove listeners from DefaultPublisher on shutdown.
parent a0b24683
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,8 @@ import org.ros.internal.node.service.ServiceDeclaration;
import org.ros.internal.node.service.ServiceFactory;
import org.ros.internal.node.service.ServiceIdentifier;
import org.ros.internal.node.service.ServiceManager;
import org.ros.internal.node.topic.DefaultPublisher;
import org.ros.internal.node.topic.DefaultSubscriber;
import org.ros.internal.node.topic.PublisherFactory;
import org.ros.internal.node.topic.SubscriberFactory;
import org.ros.internal.node.topic.TopicDeclaration;
......@@ -403,11 +405,13 @@ public class DefaultNode implements ConnectedNode {
// NOTE(damonkohler): We don't want to raise potentially spurious
// exceptions during shutdown that would interrupt the process. This is
// simply best effort cleanup.
for (Publisher<?> publisher : topicParticipantManager.getPublishers()) {
for (DefaultPublisher<?> publisher : topicParticipantManager.getPublishers()) {
publisher.shutdown();
topicParticipantManager.removePublisher(publisher);
}
for (Subscriber<?> subscriber : topicParticipantManager.getSubscribers()) {
for (DefaultSubscriber<?> subscriber : topicParticipantManager.getSubscribers()) {
subscriber.shutdown();
topicParticipantManager.removeSubscriber(subscriber);
}
for (ServiceServer<?, ?> serviceServer : serviceManager.getServers()) {
try {
......
......@@ -109,6 +109,7 @@ public class DefaultPublisher<T> extends DefaultTopicParticipant implements Publ
public void shutdown(long timeout, TimeUnit unit) {
signalOnShutdown(timeout, unit);
outgoingMessageQueue.shutdown();
listeners.shutdown();
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment