取消订阅Single的正确方法是什么?

时间:2017-12-16 13:40:39

标签: java rx-java rx-java2

我想在短暂延迟后做点什么:

public void notifyMe() {
Single
       .timer(500, TimeUnit.MILLISECONDS)
       .subscribeOn(Schedulers.io())
       .subscribe(ignore -> service.notifyMe()));
}

现在我有一个警告:"The result of subscribe is not used"。 我该如何解决?

1 个答案:

答案 0 :(得分:2)

A Single will only call once. Upon calling either method, the Single terminates and the subscription to it ends.

Link can be referred for more information.

相关问题