Skip to content

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

Merged
akarnokd merged 4 commits into
ReactiveX:1.xfrom
davidmoten:connect-returns-null
Mar 2, 2015
Merged

OperatorMulticast.connect(connection) should not return null#2779
akarnokd merged 4 commits into
ReactiveX:1.xfrom
davidmoten:connect-returns-null

Conversation

@davidmoten

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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
Copy Markdown
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

akarnokd commented Mar 2, 2015

Copy link
Copy Markdown
Member

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