Ashutosh Jha
Ashutosh Jha

Reputation: 1513

RxJava "serialize" method use cases

I want to know cases in which we need to "serialize" observable, its necessary. I mean cases in which "onNext" method will get called concurrently instead of one after another.

Upvotes: 5

Views: 1603

Answers (1)

akarnokd
akarnokd

Reputation: 69997

Originally, serialize() was introduced to fix some badly behaving custom Observables from the consumer's end instead of making the author fix his create()-ion in 1.x. As the enforcing of the Observable protocol became more prominent, there was less need for the operator in practice. It still ended up in v2 just in case and for "nostalgic reasons". Note that its sibling, Subject.toSerialized() is completely legitimate and is there to serialize access to a Subject in case it is driven from multiple threads.

Upvotes: 7

Related Questions