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

OperatorMulticast.connect(connection) should not return null #2779

Merged
merged 4 commits into from
Mar 2, 2015

Conversation

davidmoten
Copy link
Collaborator

See discussion in #2774

Changes include

  • fix for ConnectableObservable.connect() returns a null subscription if already connected #2774 just for OperatorMulticast (will do OperatorPublish in another PR once have sorted this one out)
  • made fields private that had default visibility
  • renamed OnSubscribeMulticastTest to OperatorMulticastTest
  • addressed a possible race condition that could provoke an IAE when Observable.subscribe(sub) is called with sub=null (unsubscription occurs between L144 and L145 on old code).

…n on multiple calls, address possible race condition provoking IAE
final Observable<? extends T> source;
final Object guard;
final Func0<? extends Subject<? super T, ? extends R>> subjectFactory;
private final Observable<? extends T> source;
Copy link
Member

Choose a reason for hiding this comment

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

I try to avoid private because the compiler generates accessor methods which slows down the interpreter phase and makes an extra hop while debugging methods.

@davidmoten
Copy link
Collaborator Author

Thanks @akarnokd, sharp-eyed as ever. I used a final AtomicReference to help with the == this check, is this the idiom you'd use in this situation?

@akarnokd akarnokd added the Bug label Mar 2, 2015
@akarnokd
Copy link
Member

akarnokd commented Mar 2, 2015

Thanks!

akarnokd added a commit that referenced this pull request Mar 2, 2015
OperatorMulticast.connect(connection) should not return null
@akarnokd akarnokd merged commit 4081e3f into ReactiveX:1.x Mar 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants