GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix issues that GroupBy and Sample doesn't call 'unsubscribe' and also NPE when the key is null in GroupBy by zsxwing · Pull Request #1959 · ReactiveX/RxJava

Conversation

@zsxwing

@zsxwing zsxwing commented Dec 12, 2014

Copy link
Copy Markdown
Member

Fix #1958

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
zsxwing added 3 commits December 12, 2014 11:18
@zsxwing
Fix the issue that Sample doesn't call 'unsubscribe'
f53b1e4
@zsxwing
Fix the issue that GroupBy may not call 'unsubscribe'
af3aff1
@zsxwing
Fix NPE when the key is null in GroupBy
4163352
@zsxwing

zsxwing commented Dec 12, 2014

Copy link
Copy Markdown
Member Author

Find two more bugs:

  • GroupBy may not call unsubscribe
  • NPE if the key is null in GroupBy
    The unit tests demonstrates them.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zsxwing

zsxwing commented Dec 12, 2014

Copy link
Copy Markdown
Member Author

Fixed them in this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zsxwing zsxwing changed the title Fix the issue that Sample doesn't call 'unsubscribe' Fix the issue that GroupBy and Sample doesn't call 'unsubscribe' and also NPE when the key is null in GroupBy Dec 12, 2014
@zsxwing zsxwing changed the title Fix the issue that GroupBy and Sample doesn't call 'unsubscribe' and also NPE when the key is null in GroupBy Fix issues that GroupBy and Sample doesn't call 'unsubscribe' and also NPE when the key is null in GroupBy Dec 12, 2014
akarnokd
akarnokd reviewed Dec 12, 2014
View reviewed changes
Comment thread src/main/java/rx/internal/operators/OperatorGroupBy.java Outdated

@akarnokd akarnokd Dec 12, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There is a self member variable which also points to this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@zsxwing zsxwing Dec 12, 2014

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good point.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zsxwing
Use 'self' in GroupBySubscriber to unsubscribe
b13d662
akarnokd
akarnokd reviewed Dec 12, 2014
View reviewed changes
Comment thread src/main/java/rx/internal/operators/OperatorSampleWithTime.java

@akarnokd akarnokd Dec 12, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This will unsubscribe the downstream. I suggest instead having child.add(sampler); after L52.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@benjchristensen benjchristensen Dec 12, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I haven't had a chance to try this code yet, but I want to make sure this doesn't break the backpressure functionality where this operator requests Long.MAX_VALUE up.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@zsxwing zsxwing Dec 12, 2014

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This will unsubscribe the downstream. I suggest instead having child.add(sampler); after L52.

Could you elaborate? I think unsubscribe the downstream would be OK for this operator.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@zsxwing zsxwing Dec 12, 2014

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I haven't had a chance to try this code yet, but I want to make sure this doesn't break the backpressure functionality where this operator requests Long.MAX_VALUE up.

sample with time does not support backpressure as it uses time to control data flow, right?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
zsxwing added 3 commits December 12, 2014 17:51
@zsxwing
Fix the race condition and use isEmpty instead of size
d85b87d
@zsxwing
Eliminate the lock
ec89896
@zsxwing
Update as per @akarnokd's suggestion
e309e12
akarnokd
akarnokd reviewed Dec 12, 2014
View reviewed changes
Comment thread src/main/java/rx/internal/operators/OperatorGroupBy.java

@akarnokd akarnokd Dec 12, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I feel some redundancy here. Maybe it is worth reviewing the other counters and state indicators.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zsxwing
Add 'unsubscribe' in onError
b88457f
@zsxwing

zsxwing commented Dec 12, 2014

Copy link
Copy Markdown
Member Author

This PR contains a lot. I will split it to 3 PRs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zsxwing zsxwing closed this Dec 12, 2014
@zsxwing

zsxwing commented Dec 12, 2014

Copy link
Copy Markdown
Member Author

Split to #1965 #1966 #1967

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zsxwing zsxwing mentioned this pull request Dec 12, 2014
Fix the issue that GroupBy may not call 'unsubscribe' #1967
Merged
@zsxwing
zsxwing deleted the sample-unsubscribe branch December 15, 2014 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@zsxwing @benjchristensen @akarnokd
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.