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

2.x: ObservableEmitter/FlowableEmitter Javadoc Improvement #6390

Closed
hborders opened this issue Jan 29, 2019 · 8 comments
Closed

2.x: ObservableEmitter/FlowableEmitter Javadoc Improvement #6390

hborders opened this issue Jan 29, 2019 · 8 comments

Comments

@hborders
Copy link

The javadoc for ObservableEmtter states:

The emitter allows the registration of a single resource, in the form of a Disposable or Cancellable via setDisposable(Disposable) or setCancellable(Cancellable) respectively. The emitter implementations will dispose/cancel this instance when the downstream cancels the flow or after the event generator logic calls Emitter.onError(Throwable), Emitter.onComplete() or when tryOnError(Throwable) succeeds.

Similarly, the javadoc for FlowableEmitter states:

The emitter allows the registration of a single resource, in the form of a Disposable or Cancellable via setDisposable(Disposable) or setCancellable(Cancellable) respectively. The emitter implementations will dispose/cancel this instance when the downstream cancels the flow or after the event generator logic calls Emitter.onError(Throwable), Emitter.onComplete() or when tryOnError(Throwable) succeeds.

when the downstream cancels the flow is ambiguous for a noobie like me. It isn't clear that a subscriber calling dispose will [cancel] the flow. It would be very helpful if the relationship between the *Emitter and the downstream subscriber was more explicit.

@akarnokd
Copy link
Member

You mean replace "cancels" in ObservableEmitter with "disposes"?

@akarnokd akarnokd added the 2.x label Jan 29, 2019
@hborders
Copy link
Author

I mean the documentation should explicitly say that dispose-ing a subscriber will dispose the Observable for which ObservableEmitter supplies events.

when the downstream cancels the flow is the confusing part, and I'm not sure where the documentation talks about this.

@hborders
Copy link
Author

I was under the impression that in general, an Observable or Flowable was designed to have potentially many subscribers, and so it's counter-intuitive that disposing a single subscriber would thus dispose the Observable/Flowable.

@akarnokd
Copy link
Member

I'm not sure if we want to put that level of documentation detail into those interfaces. There is a short example in the Observable JavaDocs that demonstrates disposing a sequence which is currently not there for Flowable.

I was under the impression that in general, an Observable or Flowable was designed to have potentially many subscribers, and so it's counter-intuitive that disposing a single subscriber would thus dispose the Observable/Flowable.

A subscriber/observer cancels/disposes the dedicated subscription object established when calling subscribe with said consumer. Yes, the terminology is somewhat imprecise and we use "cancels the Flowable" still as a shorthand for it.

@hborders
Copy link
Author

A subscriber/observer cancels/disposes the dedicated subscription object

Does this mean that the ObservableEmitter is the dedicated subscription object?

@akarnokd
Copy link
Member

akarnokd commented Feb 5, 2019

Technically, yes.

@akarnokd
Copy link
Member

If you want, you can create a PR with your proposed documentation changes.

@akarnokd akarnokd changed the title [2.x] ObservableEmitter/FlowableEmitter Javadoc Improvement 2.x: ObservableEmitter/FlowableEmitter Javadoc Improvement Jun 19, 2019
@akarnokd
Copy link
Member

Closing via #6535 for 3.x. If you want, you can backport it to 2.x.

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

2 participants