gpt4 book ai didi

android - RxJavaPlugins.getInstance 已弃用

转载 作者:太空狗 更新时间:2023-10-29 15:40:37 25 4
gpt4 key购买 nike

我覆盖了我的调度程序以进行测试:

RxJavaPlugins.getInstance().registerSchedulersHook(object : RxJavaSchedulersHook() {
override fun getIOScheduler() = Schedulers.immediate()
override fun getComputationScheduler() = Schedulers.immediate()
override fun getNewThreadScheduler() = Schedulers.immediate()

})

但是文档说:

Deprecated use the static methods of RxJavaHooks.

如何使用 RxJavaHooks 覆盖那些调度程序?

最佳答案

Release notes for 1.1.7包含代码示例如何在 java 中执行此操作。设置计算调度程序的小摘录:

RxJavaHooks.setOnIOScheduler(current -> Schedulers.immediate())
RxJavaHooks.setOnComputationScheduler(current -> Schedulers.immediate())
RxJavaHooks.setOnNewThreadScheduler(current -> Schedulers.immediate())

还有

By default, all RxJavaHooks delegate to the original RxJavaPlugins callbacks so if you have hooks the old way, they still work. RxJavaHooks.reset() resets to this delegation and RxJavaHooks.clear() clears all hooks (i.e., everything becomes a pass-through hook).

关于android - RxJavaPlugins.getInstance 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38616015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com