I have following idl structure. I want to publish it using opendds
#pragma DCPS_DATA_TYPE "B::CData"
#pragma DCPS_DATA_KEY "B::CData id"
module B {
struct Quote {
string skit_name;
string episode_name;
string line;
};
struct CData{
long id;
Quote payload;
};
};
I have written publisher and subscriber in java. but while publishing and subscribing to above topic JVM crashes.
Any one has idea about this?
Below is the java code for public Topic
public static void main(String[] args) {
DomainParticipantFactory dpf =
TheParticipantFactory.WithArgs(new StringSeqHolder(args));
if (dpf == null) {
System.err.println ("Domain Participant Factory not found");
return;
}
final int DOMAIN_ID = 42;
DomainParticipant dp = dpf.create_participant(DOMAIN_ID,
PARTICIPANT_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value);
if (dp == null) {
System.err.println ("Domain Participant creation failed");
return;
}
CDataTypeSupportImpl servant = new CDataTypeSupportImpl();
if (servant.register_type(dp, "") != RETCODE_OK.value) {
System.err.println ("register_type failed");
return;
}
Topic top = dp.create_topic("data",
servant.get_type_name(),
TOPIC_QOS_DEFAULT.get(), null,
DEFAULT_STATUS_MASK.value);
Publisher pub = dp.create_publisher(
PUBLISHER_QOS_DEFAULT.get(),
null,
DEFAULT_STATUS_MASK.value);
DataWriter dw = pub.create_datawriter(
top, DATAWRITER_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value);
CDataDataWriter mdw = CDataDataWriterHelper.narrow(dw);
CData cData=new CData();
int handle = mdw.register(cData);
// above statement crashes the jvm
int ret = mdw.write(msg, handle);
}