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

Add Counter Tutorial #31

Merged
merged 1 commit into from Jan 10, 2018
Merged

Add Counter Tutorial #31

merged 1 commit into from Jan 10, 2018

Conversation

pruivo
Copy link
Member

@pruivo pruivo commented Jul 17, 2017

No description provided.

Copy link
Member

@galderz galderz left a comment

Choose a reason for hiding this comment

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

The tutorial seems fine. Just a small comment about the javadoc of (bounded) StrongCounter.

return 0;
}).get();

// Check the counter value. It should be the upper-bound (10)
Copy link
Member

Choose a reason for hiding this comment

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

This behaviour is not specified in the getValue javadoc. The method's javadoc should mention that if an attempt has been to go pass the upper bound, next time getValue is called, the upper bound would be returned.

The reason I think this is important is because one could expect that if an exception is thrown after trying to update a count beyond its upper bound, the value of the counter would be the value before trying to overflow it?

Copy link
Member Author

Choose a reason for hiding this comment

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

so, you think it would make more sense to abort the update if it overflows the counter?

Copy link
Member

Choose a reason for hiding this comment

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

I did consider that but I don't think aborting the update is a good idea since numbers don't work that way in Java itself. I think the option you've chosen is fine but I'd just javadoc it so that it's clear :)

@galderz
Copy link
Member

galderz commented Jan 10, 2018

Sorry @pruivo, this needs rebasing.

@galderz
Copy link
Member

galderz commented Jan 10, 2018

Actually, let me see if I can solve it myself.

@galderz
Copy link
Member

galderz commented Jan 10, 2018

I'm integrating this, @pruivo to add the code for the website next.

@galderz galderz merged commit 6023c1b into master Jan 10, 2018
@galderz galderz deleted the t_counter_tutorial branch January 24, 2018 11:07
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

2 participants