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

Fixed synchronous ConnectableObservable.connect problem #1175

Merged

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented May 8, 2014

ConnectableObservable.connect returns a Subscription and thus cannot be unsubscribed synchronously, similar how take didn't work before the Subscriber changes. This PR modifies the ConnectableObservable and its current implementation OperatorMulticast to extract the connection Subscription token before it is connected to the source. Cancelling this extracted token makes sure the synchronous connection is unsubscribed.

(The Rx.NET version of the test case seemingly doesn't exhibit the problem. I suspect it is the interplay of IDisposables.)

@cloudbees-pull-request-builder

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

connect(new Action1<Subscription>() {
@Override
public void call(Subscription t1) {
out[0] = t1;
Copy link
Member

Choose a reason for hiding this comment

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

Clever.

Quite timely for you to have fixed this as I came across this problem just last night.

benjchristensen added a commit that referenced this pull request May 16, 2014
…usFix

Fixed synchronous ConnectableObservable.connect problem
@benjchristensen benjchristensen merged commit 570a8f9 into ReactiveX:master May 16, 2014
@akarnokd akarnokd deleted the ConnectableObservableSynchronousFix branch May 16, 2014 06:28
@benjchristensen benjchristensen mentioned this pull request Jun 1, 2014
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.

None yet

3 participants