WorkQueueProcessor无法运行,并显示错误“不安全可用”

时间:2018-09-11 15:11:06

标签: project-reactor reactor

我正在从反应堆中试用WorkQueueProcessor,这是我的简单测试:

WorkQueueProcessor.Builder<String> topicProcessorBuilder = WorkQueueProcessor.builder();
    WorkQueueProcessor<String> hotSource = topicProcessorBuilder
      .build();

    Flux<String> hotFlux = hotSource.publish()
      .autoConnect()
      .map(String::toUpperCase);


    hotFlux.subscribe(d -> System.out.println(Thread.currentThread() + " Subscriber 1 to Hot Source: " + d));

    hotSource.onNext("ram");
    hotSource.onNext("sam");

    hotFlux.subscribe(d -> System.out.println(Thread.currentThread() + " Subscriber 2 to Hot Source: " + d));

    hotSource.onNext("dam");
    hotSource.onNext("lam");
    hotSource.onComplete();

在输出中,我可以看到:

  

20:25:46.226 [main]调试反应堆.util.Loggers $ LoggerFactory-使用   Slf4j日志记录框架20:25:46.246 [main]调试   Reactor.core.publisher.UnsafeSupport-在以下位置启动UnsafeSupport初始化   Java 1.8 20:25:46.248 [main]调试   Reactor.core.publisher.UnsafeSupport-不安全可用

如何解决此错误并使它按预期执行?预先感谢。

0 个答案:

没有答案