Closed
Description
Currently, onError
cuts ahead of onNext
calls when you schedule work, but does not (cannot) when you use a single thread.
Observable.create(o -> {
o.onNext(1);
o.onError(new NotImplementedException());
})
.observeOn(Schedulers.newThread())
.subscribe(i -> System.out.println(i),
e -> System.out.println("error:" + e));
This yields error
instead of 1, error
as expected. Other implementations of Rx like Rx.Net do serialize notifications. This 'cut ahead' behavior is actually described as a common pitfall in RxJava by some.