What are the benefits to use Schedulers.newThread()
vs Schedulers.io()
in Retrofit
network request. I have seen many examples that use io()
, but I want to understand why.
Example situation:
observable.onErrorResumeNext(refreshTokenAndRetry(observable))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())...
vs
observable.onErrorResumeNext(refreshTokenAndRetry(observable))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())...
One of the reasons i have seen is -
newThread()
creates a new thread for each unit of work. io()
will use a thread pool
But what is the influence of that argument on the app? And what other aspects there are?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…