MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / main

Method main

java/tests/messenger/both/Both.java:17–178  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

15 private static final int N_MSGS = 40;
16
17 public static void main(String[] args) {
18
19 System.out.println("Start Publisher and Subscriber");
20
21 DomainParticipantFactory dpf =
22 TheParticipantFactory.WithArgs(new StringSeqHolder(args));
23 if (dpf == null) {
24 System.err.println("ERROR: Domain Participant Factory not found");
25 return;
26 }
27 DomainParticipant dp = dpf.create_participant(4,
28 PARTICIPANT_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value);
29 if (dp == null) {
30 System.err.println("ERROR: Domain Participant creation failed");
31 return;
32 }
33
34 MessageTypeSupportImpl servant = new MessageTypeSupportImpl();
35 if (servant.register_type(dp, "") != RETCODE_OK.value) {
36 System.err.println("ERROR: register_type failed");
37 return;
38 }
39
40 Publisher pub = dp.create_publisher(PUBLISHER_QOS_DEFAULT.get(), null,
41 DEFAULT_STATUS_MASK.value);
42 if (pub == null) {
43 System.err.println("ERROR: Publisher creation failed");
44 return;
45 }
46
47 Subscriber sub = dp.create_subscriber(SUBSCRIBER_QOS_DEFAULT.get(),
48 null, DEFAULT_STATUS_MASK.value);
49 if (sub == null) {
50 System.err.println("ERROR: Subscriber creation failed");
51 return;
52 }
53
54 Topic top = dp.create_topic("Movie Discussion List",
55 servant.get_type_name(),
56 TOPIC_QOS_DEFAULT.get(),
57 null,
58 DEFAULT_STATUS_MASK.value);
59 if (top == null) {
60 System.err.println("ERROR: Topic creation failed");
61 return;
62 }
63
64 DataWriter dw = pub.create_datawriter(top,
65 DATAWRITER_QOS_DEFAULT.get(),
66 null,
67 DEFAULT_STATUS_MASK.value);
68 if (dw == null) {
69 System.err.println("ERROR: DataWriter creation failed");
70 return;
71 }
72 int dw_handle = dw.get_instance_handle();
73
74 DataReader dr = sub.create_datareader(top,

Callers

nothing calls this directly

Calls 15

WithArgsMethod · 0.95
getMethod · 0.95
getMethod · 0.95
getMethod · 0.95
getMethod · 0.95
getMethod · 0.95
getMethod · 0.95
attach_conditionMethod · 0.95
waitMethod · 0.95
detach_conditionMethod · 0.95
shutdownMethod · 0.95
set_enabled_statusesMethod · 0.80

Tested by

no test coverage detected