Created
November 7, 2012 09:30
-
-
Save sandorkan/4030389 to your computer and use it in GitHub Desktop.
Creation of DataReader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the data reader using the default publisher | |
StringDataReader dataReader = (StringDataReader) participant.create_datareader( | |
topic, //Topic | |
Subscriber.DATAREADER_QOS_DEFAULT, // QoS | |
new HelloSubscriber(), // Listener | |
StatusKind.DATA_AVAILABLE_STATUS); // mask | |
if (dataReader == null) { | |
System.err.println("Unable to create DDS Data Reader"); | |
return; | |
} | |
// Reading User-Input | |
System.out.println("Ready to read data."); | |
System.out.println("Press CTRL+C to terminate."); | |
for (;;) { | |
try { | |
Thread.sleep(2000); | |
if(shutdown_flag) break; | |
} catch (InterruptedException e) { | |
// Nothing to do... | |
} | |
} | |
System.out.println("Shutting down..."); | |
// Deleting entities and DomainParticipant | |
participant.delete_contained_entities(); | |
DomainParticipantFactory.get_instance().delete_participant(participant); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment