订户未接收数据 - rti dds

时间:2017-04-02 15:04:45

标签: java data-distribution-service

我创建了一个示例rti dds java项目。 但是,如果writer.write()不在具有线程休眠的循环中,则订阅者不会收到数据。

订阅者无法获取数据

instance.ID = 10;
instance.value = 3.14;
writer.write(instance, instance_handle);

订阅者获取数据

        for (int count = 0;
        (sampleCount == 0) || (count < sampleCount);
        ++count) {
            System.out.println("Writing myExample, count " + count);

            /* Modify the instance to be written here */

            /* Write data */
            instance.ID = 10;
            instance.value = 3.14;
            writer.write(instance, instance_handle);
            try {
                Thread.sleep(sendPeriodMillis);
            } catch (InterruptedException ix) {
                System.err.println("INTERRUPTED");
                break;
            }
        }

0 个答案:

没有答案