mergeruns concurrent. After merge the pipeline is serialized.
onNextwill run serialized, but the 3 calls to
Observable.interval(1000 millis)This spawns a thread that calls
observable.onNextand then schedule itself to do so again in 1 second. If
onNexttakes 900ms to return, it will wait for 100ms.
onNextwill then run the code inside
.map(...), continue to run the code in
.merge(...), continue with
take(100)and then subscribe. It returns and sleeps 100ms.
Observable.interval(3000 millis)does the same, because thread1 is bussy, the scheduler gives it a new thread. This thread will call
mapin parallel with
aand then get to
merge. Merge is already bussy with
aat this time (assuming is arrives there just after
adid), so it schedules it's event and returns. It will then schedule itself to call
onNextagain 3 seconds after the first event.
awill then probably be used to call
take(100)and subscribe, before returning to a.
onCompeted, guess you can write an operator that does that.