Skip to content

ZOOKEEPER-1871: Add an option to zkCli to wait for connection before executing commands#1621

Closed
MuktiKrishnan wants to merge 2 commits intoapache:branch-3.6from
MuktiKrishnan:ZOOKEEPER-1871
Closed

ZOOKEEPER-1871: Add an option to zkCli to wait for connection before executing commands#1621
MuktiKrishnan wants to merge 2 commits intoapache:branch-3.6from
MuktiKrishnan:ZOOKEEPER-1871

Conversation

@MuktiKrishnan
Copy link
Contributor

@MuktiKrishnan MuktiKrishnan commented Mar 4, 2021

-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.

@MuktiKrishnan MuktiKrishnan changed the title ZOOKEEPER-1871: Add an option to zkCli to wailt for connection before… ZOOKEEPER-1871: Add an option to zkCli to wait for connection before… Mar 5, 2021
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
Copy link
Member

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

Copy link
Contributor Author

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) {
Copy link
Member

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?

Copy link
Contributor Author

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

@arshadmohammad
Copy link
Contributor

@MuktiKrishnan please raise PR on master first

@MuktiKrishnan MuktiKrishnan changed the title ZOOKEEPER-1871: Add an option to zkCli to wait for connection before… ZOOKEEPER-1871: Add an option to zkCli to wait for connection before executing commands Mar 9, 2021
@MuktiKrishnan
Copy link
Contributor Author

@MuktiKrishnan please raise PR on master first

I have raised PR on master branch.

@arshadmohammad
Copy link
Contributor

These changes are being merged from #1626 PR

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.

3 participants