以下でreactor-core 1.1.4-RELEASE
試しましたが、何も印刷されませんでした。何を見逃したはずですか?
Reactor reactor = Reactors.reactor(new Environment());
reactor.on(
$("hello"),
(Event<String> ev) -> System.out.println("hello "
+ ev.getData()));
reactor.notify("hello", Event.wrap("world"));
@編集
以下のテストでは、受信側のデーモン スレッドがイベントを処理する前に終了できることを確認します。
Reactor reactor = Reactors.reactor(new Environment());
reactor.on($("hello"), (Event<String> ev) -> {
System.out.println(Thread.currentThread().getName());
System.out.println(Thread.currentThread().isDaemon());
System.out.println("hello " + ev.getData());
});
reactor.notify("hello", Event.wrap("world"));
try {
Thread.sleep(1000);
} catch (Exception e) {
}