What's the correct way to unsubscribe from Single [duplicate]

*爱你&永不变心* 提交于 2020-01-06 07:14:02

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/47846275/whats-the-correct-way-to-unsubscribe-from-single

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!