问题
I have a question. Is possible run two tasks asynchronously in single threaded environment in RxJava? I know that Java should contain library for this functionality, but i think that RxJava does not contain it.
回答1:
Of course it contains single threaded asynchronous processing at it contains any thread count processing.
Example
Flowable.fromCallable(() ->{
// do something
})
.subscribeOn(Schedulers.single());
Alternatives to Schedulers.single()
is Schedulers.from(Executors.newFixedThreadPool(1))
where you can specify thread pool
来源:https://stackoverflow.com/questions/48267688/rxjava-single-thread-asynchronous-processing