I have the following code for an RTI DDS publisher
package xml;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import org.xml.sax.SAXException;
import com.rti.dds.domain.DomainParticipant;
import com.rti.dds.domain.DomainParticipantFactory;
import com.rti.dds.domain.DomainParticipantQos;
import com.rti.dds.infrastructure.Duration_t;
import com.rti.dds.infrastructure.HistoryQosPolicyKind;
import com.rti.dds.infrastructure.InstanceHandle_t;
import com.rti.dds.infrastructure.PropertyQosPolicyHelper;
import com.rti.dds.infrastructure.RETCODE_ERROR;
import com.rti.dds.infrastructure.RETCODE_TIMEOUT;
import com.rti.dds.infrastructure.ReliabilityQosPolicyKind;
import com.rti.dds.infrastructure.StatusKind;
import com.rti.dds.publication.DataWriterQos;
import com.rti.dds.publication.Publisher;
import com.rti.dds.topic.Topic;
import com.rti.dds.type.builtin.StringDataWriter;
import com.rti.dds.type.builtin.StringTypeSupport;
public class sender {
public static void main(String[] args) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ParserConfigurationException, SAXException, TransformerFactoryConfigurationError, TransformerException, IOException, InterruptedException{
DomainParticipantQos dp_qos = new DomainParticipantQos();
DomainParticipantFactory.get_instance().get_default_participant_qos(dp_qos);
PropertyQosPolicyHelper.add_property(dp_qos.property,"dds.builtin_type.string.max_size","3000",true);
DomainParticipant participant = DomainParticipantFactory.get_instance().create_participant(0,dp_qos, null,StatusKind.STATUS_MASK_NONE);
if (participant == null)
{
System.err.println("Unable to create domain participant");
return;
}
Topic topic = participant.create_topic(
"Event Logging",
StringTypeSupport.get_type_name(),
DomainParticipant.TOPIC_QOS_DEFAULT,
null, // listener
StatusKind.STATUS_MASK_NONE);
if (topic == null)
{
System.err.println("Unable to create topic.");
return;
}
DataWriterQos datawriter_qos = new DataWriterQos();
participant.get_default_datawriter_qos(datawriter_qos);
PropertyQosPolicyHelper.add_property(datawriter_qos.property,"dds.builtin_type.string.alloc_size" ,"2500" ,true);
datawriter_qos.reliability.kind = ReliabilityQosPolicyKind.RELIABLE_RELIABILITY_QOS;
datawriter_qos.history.kind = HistoryQosPolicyKind.KEEP_ALL_HISTORY_QOS;
StringDataWriter dataWriter =
(StringDataWriter) participant.create_datawriter(
topic,
Publisher.DATAWRITER_QOS_DEFAULT,
null, // listener
StatusKind.STATUS_MASK_NONE);
if (dataWriter == null)
{
System.err.println("Unable to create data writer\n");
return;
}
//System.out.println("Ready to write data.");
//System.out.println("When the subscriber is ready, you can start writing.\n");
String toWrite = xmlReader.main(args).toString();
for(int i =0;i<5;i++)
{
Thread.sleep(7000);
dataWriter.write(toWrite, InstanceHandle_t.HANDLE_NIL);
System.out.println("sent");
}
System.out.println("Waiting for ackn...");
Duration_t wait = new Duration_t();
wait.sec = Duration_t.DURATION_INFINITE_SEC;
wait.nanosec = Duration_t.DURATION_INFINITE_SEC;
dataWriter.wait_for_acknowledgments(wait);
System.out.println("Exiting...");
participant.delete_contained_entities();
DomainParticipantFactory.get_instance().delete_participant(participant);
}
}
and each time I run scripts/perftest_java on my Centos 6.6 machine all I get is
Waiting to discover 1 publishers ...
Why is it not discovering my publisher at all?