Observables must issue notifications to observers serially (not in parallel). They may issue these notifications from different threads, but there must be a formal happens-before relationship between the notifications.
When it says "happens-before", Does it mean that all the effects by the last onNext notification, (e.g. change an shared state in Observer.onNext() method), will be totally visible to the next onNext notification, just like happens-before guarantee in Java Memory Model?
After reading source code of SerializedObserver(RxJava version 3.0.11), I found downstream.onNext(t) method is not called in the synchronized code block. So, could I say the answer is not?
will be totally visible to the next onNext notification, just like happens-before guarantee in Java Memory Model?
Yes.
SerializedObserver [...] I found downstream.onNext(t) method is not called in the synchronized code block. So, could I say the answer is not?
Still yes. The synchronized (this) ensures visibility as well as the property that only one thread will be calling onNext
because of the emitting
flag.