[
https://issues.apache.org/jira/browse/ZOOKEEPER-2037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14134489#comment-14134489
]
Hadoop QA commented on ZOOKEEPER-2037:
--------------------------------------
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12668864/ZOOKEEPER-2037.patch
against trunk revision 1623916.
+1 @author. The patch does not contain any @author tags.
-1 tests included. The patch doesn't appear to include any new or modified
tests.
Please justify why no new tests are needed for this
patch.
Also please list what manual steps were performed to
verify this patch.
-1 patch. The patch command could not apply the patch.
Console output:
https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/2331//console
This message is automatically generated.
> ZooKeeper methods to wait on client connection (re)establishment.
> -----------------------------------------------------------------
>
> Key: ZOOKEEPER-2037
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2037
> Project: ZooKeeper
> Issue Type: Sub-task
> Components: java client
> Affects Versions: 3.5.0
> Reporter: Hongchao Deng
> Assignee: Hongchao Deng
> Attachments: ZOOKEEPER-2037.patch
>
>
> When a ZooKeeper object is created and returned, it is not guaranteed that
> connection to a server is established.
> Usually, a wait/signal pattern is used for the ZK watcher
> {code}
> latch = new CountDownLatch(1)
> zk = new ZooKeeper(..., new Watcher() {
> override void process(WatchedEvent event) {
> if (event.type = SyncConnected) {
> latch.countDown()
> }
> }
> },...)
> latch.wait();
> // connection has been established. do something with zk.
> {code}
> There are two disadvantages:
> 1. The latch object isn't being garbage-collected. Because the watcher keeps
> monitoring all kinds of events.
> 2. With the introduction of dynamic reconfig, client move to other servers on
> needed and this latch method doesn't work so well.
> Here I propose to add (both sync and async) wait methods to act as latch for
> connection establish such that it becomes much easier to manage and work
> around:
> {code}
> zk = new ZooKeeper(...)
> zk.waitUntilConnected()
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)