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

ZOOKEEPER-3663: Clean Up ZNodeName Class #1193

Closed
wants to merge 1 commit into from

Conversation

belugabehr
Copy link
Contributor

No description provided.

*/
public int getZNodeName() {
public Optional<Integer> getSequence() {
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like this method is called only in tests.
you can drop the 'public' modifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the other getters are also public, so I think it should be consistent with them.

if (idx >= 0) {
private final String name;
private final String prefix;
private final Optional<Integer> sequence;
Copy link
Contributor

Choose a reason for hiding this comment

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

The difference from int to Optional in terms of space/memory usage is considerable.
Is it really worth to change it ?

This is only a 'recipe' so not a big deal, but I wonder if is it better to keep it simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eolivelli I always prefer using Optional. It's always very clear as to its usage and the caller must deal with it. Better than forcing the user to correctly check for a special negative value that indicates 'no sequence available'. This is not performance-critical code, so readability and usability should be prioritized.

@belugabehr
Copy link
Contributor Author

@eolivelli Thank you always for your reviews.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

Thank you

@maoling
Copy link
Member

maoling commented Dec 25, 2019

@belugabehr
You may also interested in ZOOKEEPER-3221. Haha. I am issue recommender system.

Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

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

+1

@asfgit asfgit closed this in ee69a55 Jan 21, 2020
@anmolnar
Copy link
Contributor

Committed to master branch. Thanks @belugabehr !

junyoungKimGit pushed a commit to junyoungKimGit/zookeeper that referenced this pull request Feb 7, 2020
Author: David Mollitor <dmollitor@apache.org>

Reviewers: eolivelli@apache.org, andor@apache.org

Closes apache#1193 from belugabehr/ZOOKEEPER-3663
stickyhipp pushed a commit to stickyhipp/zookeeper that referenced this pull request Aug 19, 2020
Author: David Mollitor <dmollitor@apache.org>

Reviewers: eolivelli@apache.org, andor@apache.org

Closes apache#1193 from belugabehr/ZOOKEEPER-3663
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
Author: David Mollitor <dmollitor@apache.org>

Reviewers: eolivelli@apache.org, andor@apache.org

Closes apache#1193 from belugabehr/ZOOKEEPER-3663
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
Author: David Mollitor <dmollitor@apache.org>

Reviewers: eolivelli@apache.org, andor@apache.org

Closes apache#1193 from belugabehr/ZOOKEEPER-3663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants