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

Implemented the 'Throw' operator with scheduler #416

Merged
merged 2 commits into from
Oct 9, 2013

Conversation

zsxwing
Copy link
Member

@zsxwing zsxwing commented Sep 30, 2013

Hi,

I implemented the Throw operator #89 with scheduler. I found that RxJava had an error method. So I just implemented the scheduler overload.

@cloudbees-pull-request-builder

RxJava-pull-requests #324 SUCCESS
This pull request looks good

* @see <a href="http://msdn.microsoft.com/en-us/library/hh211711(v=vs.103).aspx">MSDN: Observable.Throw Method</a>
*/
public static <T> Observable<T> error(Throwable exception, Scheduler scheduler) {
return Observable.<T> error(exception).observeOn(scheduler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be subscribeOn instead of observeOn?

For example, in the other pull request https://github.com/Netflix/RxJava/pull/415/files#diff-5ec494b927739f6fefe3a4d351a9dd05R566 it uses subscribeOn.

I believe we want subscribeOn so the actual subscription and callbacks occur on that scheduler instead of observeOn which schedules each notification on a separate scheduler but doesn't change where the work is done.

In this case it has little practical effect as all it does is throw, but I'd like consistency, and subscribeOn is the more efficient and accurate approach I think?

@zsxwing
Copy link
Member Author

zsxwing commented Oct 9, 2013

@benjchristensen I agree with you. I updated the codes and rebased it to master.

@cloudbees-pull-request-builder

RxJava-pull-requests #338 SUCCESS
This pull request looks good

benjchristensen added a commit that referenced this pull request Oct 9, 2013
Implemented the 'Throw' operator with scheduler
@benjchristensen benjchristensen merged commit 2c4b2c5 into ReactiveX:master Oct 9, 2013
@zsxwing zsxwing deleted the throw branch October 10, 2013 11:39
rickbw pushed a commit to rickbw/RxJava that referenced this pull request Jan 9, 2014
Implemented the 'Throw' operator with scheduler
jihoonson pushed a commit to jihoonson/RxJava that referenced this pull request Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants