-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
HostAndPort.convertHost() to resolve localhost in a lazy manner #1468
Conversation
There is some issue with redis dependencies in Travis. Tests passed in my local with |
LGTM @HeartSaVioR, @allanwax ? |
@jkrahul can you rebase with master so tests pass please? |
return host; | ||
} | ||
} | ||
|
||
public static void setLocalhost(String localhost) { |
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.
Are there any actual usages for setLocalhost()
? setLocalhost()
and getLocalhost()
can make race condition.
Btw, getLocalhost()
itself can make race condition but it might be OK given that getLocalHostQuietly()
always returns same value.
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.
@marcosnils @jkrahul The only use I can think of is a potential one. If the programmer wants to override the natural local host value, say with the ENDPOINT
value, then they can make this call change it. This would be done before actually creating a Jedis instance.
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 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.
Wrapping the operations inside setLocalhost
and getLocalhost
will make it safe and is less heavy weight than synchronized
.
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.
@marcosnills @jkrahul I was imagining the wrapping being a ReentrantLock. I'm good .
@jkrahul I've done reviewing and left comment. |
@jkrahul Please rebase and address review comment. Thanks in advance! |
2541c82
to
f2f617d
Compare
@marcosnils @HeartSaVioR @allanwax review comments have been addressed. Please check |
I believe we're good now. @allanwax @HeartSaVioR ? |
@marcosnils Yes LGTM. |
Merged to master and 2.10 respectively. @jkrahul Thanks for contribution! |
fixes #1424