为什么我要使用RxJava2CallAdapterFactory.createWithScheduler?

问题描述

我正在使用Retrofit + RxJava2并在创建Retrofit Service时设置呼叫适配器工厂

new Retrofit.Builder()
    .baseUrl(...)
    .addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()))
    .client(okHttpClient)
    .build()
    .create(MyService.class);

我现在在创建新线程presumably because Schedulers.io() is not limited in it's thread creation时遇到了OOM。

在查看Retrofit's RxJava2 Adapter的文档时,我可能应该使用createAsync()以避免每次 请求都必须调用subscribeOn()

所以问题是为什么我要使用createAsync()?我可能从一个没有遇到我现在遇到的同样问题的教程中抽出了RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io()。但是要全面了解,我想知道为什么我要设置自己的调度程序?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)