O'Reilly logo

Learning Reactive Programming with Java 8 by Nickolay Tsvetinov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Using Concurrency and Parallelism with Schedulers

Modern processors have multiple cores and enable many time-consuming operations to be processed faster simultaneously. The Java concurrency API (which includes threads and much more) makes it possible to do just that.

RxJava's Observable chains seem a good match for the threads. It would be great if we could subscribe to our source and do all the transforming, combining, and filtering in the background and, when everything is done, have the result to be passed to the main threads. Yes, this sounds wonderful, but RxJava is single-threaded by default. This means that, in the most cases, when the subscribe method is called on an Observable instance, the current thread blocks until everything ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required