我正在从反应堆中试用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-不安全可用
如何解决此错误并使它按预期执行?预先感谢。