Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address the issues mentioned in https://speakerdeck.com/dlew/common-rxjava-mistakes #2

Open
bangarharshit opened this issue Dec 12, 2017 · 2 comments

Comments

@bangarharshit
Copy link
Owner

No description provided.

@bangarharshit
Copy link
Owner Author

Rx1

o1.subscribe(subcriber);
o2.subscribe(subscriber);

Subject checks for both Rx1 and Rx2:

o1.subscribe(subject);
o2.subscribe(subject); //Incorrect for non-serialized subjects as others are not thread safe. - https://artemzin.com/blog/rxjava-thread-safety-of-operators-and-subjects/

subject.onNext("dfdf") // Thread safety.

Multiple subscribeOn

Observable.just(1).subscribeOn("1).subscribeOn("2")

@bangarharshit
Copy link
Owner Author

Also, the following example is equally problematic as subclasses of an observer can be stateful. The best case is to never allow multiple subscriptions with the same observer or consumer.

o1.subscribe(observer);
o2.subscribe(observer);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant