June 2017
Intermediate to advanced
400 pages
8h 44m
English
Concurrency in RxJava is simple to execute, but somewhat abstract to understand. By default, Observables execute work on the immediate thread, which is the thread that declared the Observer and subscribed it. In many of our earlier examples, this was the main thread that kicked off our main() method.
But as hinted in a few other examples, not all Observables will fire on the immediate thread. Remember those times we used Observable.interval(), as shown in the following code? Let's take a look:
import io.reactivex.Observable;import java.util.concurrent.TimeUnit;public class Launcher { public static void main(String[] args) { Observable.interval(1, TimeUnit.SECONDS) .map(i -> i + " Mississippi") .subscribe(System ...
Read now
Unlock full access