Schedulers.io()和Schedulers.computation()有什么区别 [英] What is the difference between Schedulers.io() and Schedulers.computation()

查看:329
本文介绍了Schedulers.io()和Schedulers.computation()有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在沙发上使用Observables.

I use Observables in couchbase.

Schedulers.io() Schedulers.computation()有什么区别?

推荐答案

来自 rx文档:

Schedulers.computation() -用于诸如事件循环和回调处理之类的计算工作;不要将此调度程序用于I/O(改为使用Schedulers.io());默认情况下,线程数等于处理器数

Schedulers.computation( ) - meant for computational work such as event-loops and callback processing; do not use this scheduler for I/O (use Schedulers.io( ) instead); the number of threads, by default, is equal to the number of processors


Schedulers.io() -用于进行I/O绑定的工作,例如阻塞I/O的异步性能,此调度程序由线程池支持,该线程池将根据需要增长;对于普通的计算工作,请切换到Schedulers.computation();.Schedulers.io()默认为CachedThreadScheduler,类似于带有线程缓存的新线程调度程序

Schedulers.io( ) - meant for I/O-bound work such as asynchronous performance of blocking I/O, this scheduler is backed by a thread-pool that will grow as needed; for ordinary computational work, switch to Schedulers.computation( ); Schedulers.io( ) by default is a CachedThreadScheduler, which is something like a new thread scheduler with thread caching

这篇关于Schedulers.io()和Schedulers.computation()有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆