June 2017
Intermediate to advanced
400 pages
8h 44m
English
So how do we mitigate this? You could get hacky and try to use native Java concurrency tools such as semaphores. But thankfully, RxJava has a streamlined solution to this problem: the Flowable. The Flowable is a backpressured variant of the Observable that tells the source to emit at a pace specified by the downstream operations.
In the following code, replace Observable.range() with Flowable.range(), and this will make this entire chain work with Flowables instead of Observables. Run the code and you will see a very different behavior with the output:
import io.reactivex.Observable; import io.reactivex.schedulers.Schedulers; import io.reactivex.Flowable; public class Launcher { public static void main(String[] ...Read now
Unlock full access