-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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-1871: Add an option to zkCli to wait for connection before executing commands #1621
Conversation
… executing commands
String[] args1 = {"-server", "localhost:" + invalid_port, "-timeout", | ||
Long.toString(timeout), "-waitforconnection", "ls", "/"}; | ||
long start_time = System.currentTimeMillis(); | ||
// try to connect to a non-existing server so as to wait until wait_timeout |
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.
using CamelCase naming style(e.g.: startTime
) in the UT
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.
Used CamelCase naming style. Thanks @maoling for pointing out
} | ||
int timeout = Integer.parseInt(cl.getOption("timeout")); | ||
zk = new ZooKeeperAdmin(host, timeout, new MyWatcher(),readOnly); | ||
if (connectLatch != null) { |
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.
Could you please add more clarifications about the difference between waitforconnection
and timeout
in the GitHub description?
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 have given some clarification on waitforconnection and timeout options in GitHub description. Thanks
@MuktiKrishnan please raise PR on master first |
I have raised PR on master branch. |
These changes are being merged from #1626 PR |
-waitforconnection option will make zk client wait for -timeout time to connect to zk server. timeout time is 30ms by default but can be specified explicitly using -timeout option.