(final String text)
| 80 | } |
| 81 | |
| 82 | public void write(final String text) { |
| 83 | Publisher publisher = |
| 84 | participant.create_publisher(PUBLISHER_QOS_DEFAULT.get(), null, DEFAULT_STATUS_MASK.value); |
| 85 | |
| 86 | assert (publisher != null); |
| 87 | |
| 88 | TheTransportRegistry.bind_config(transportConfig, publisher); |
| 89 | |
| 90 | publisher.create_datawriter(topic, DATAWRITER_QOS_DEFAULT.get(), |
| 91 | new _DataWriterListenerLocalBase() { |
| 92 | public void on_liveliness_lost(DataWriter dw, LivelinessLostStatus status) {} |
| 93 | |
| 94 | public void on_offered_deadline_missed(DataWriter dw, OfferedDeadlineMissedStatus status) {} |
| 95 | |
| 96 | public void on_offered_incompatible_qos(DataWriter dw, OfferedIncompatibleQosStatus status) {} |
| 97 | |
| 98 | public void on_publication_matched(DataWriter dw, PublicationMatchedStatus status) { |
| 99 | if (status.total_count < 1) { |
| 100 | throw new IllegalArgumentException("Unable to match publication!"); |
| 101 | } |
| 102 | |
| 103 | MessageDataWriter writer = MessageDataWriterHelper.narrow(dw); |
| 104 | |
| 105 | Message message = new Message(); |
| 106 | message.text = text; |
| 107 | |
| 108 | int handle = writer.register_instance(message); |
| 109 | if (writer.write(message, handle) != RETCODE_OK.value) { |
| 110 | throw new IllegalStateException("Unable to write message!"); |
| 111 | } |
| 112 | |
| 113 | System.out.printf("[%s] wrote %s\n", participant, message); |
| 114 | } |
| 115 | }, DEFAULT_STATUS_MASK.value |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | public void read() { |
| 120 | Subscriber subscriber = |
no test coverage detected