Skip to content

Scheduling should serialize notifications. #3542

Closed
@Dorus

Description

@Dorus

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions