取消订阅 Single 的正确方法是什么 [英] What's the correct way to unsubscribe from Single
本文介绍了取消订阅 Single 的正确方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在短暂的延迟后做点什么:
I want to do something after short delay:
public void notifyMe() {
Single
.timer(500, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.subscribe(ignore -> service.notifyMe()));
}
现在我有一个警告:订阅的结果没有被使用"
.我该如何解决?
Now I have a warning: "The result of subscribe is not used"
.
How can I fix it?
推荐答案
A Single 只会调用一次.调用任一方法后,Single 终止并结束对它的订阅.
A Single will only call once. Upon calling either method, the Single terminates and the subscription to it ends.
链接可参考.
这篇关于取消订阅 Single 的正确方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文