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
Conversation
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.
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) |
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 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?
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.
so, you think it would make more sense to abort the update if it overflows the counter?
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 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 :)
Sorry @pruivo, this needs rebasing. |
Actually, let me see if I can solve it myself. |
cb581d4
to
bea0823
Compare
I'm integrating this, @pruivo to add the code for the website next. |
No description provided.