zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arshadmohammad <...@git.apache.org>
Subject [GitHub] zookeeper pull request #153: ZOOKEEPER-2671: Fix compilation error in branch...
Date Mon, 23 Jan 2017 06:11:46 GMT
Github user arshadmohammad commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/153#discussion_r97257715
  
    --- Diff: src/java/test/org/apache/zookeeper/test/ClientBase.java ---
    @@ -664,4 +664,32 @@ public static String join(String separator, Object[] parts) {
             }
             return sb.toString();
         }
    +
    +    public static ZooKeeper createZKClient(String cxnString) throws Exception {
    +        return createZKClient(cxnString, CONNECTION_TIMEOUT);
    +    }
    +
    +    /**
    +     * Returns ZooKeeper client after connecting to ZooKeeper Server. Session
    +     * timeout is {@link #CONNECTION_TIMEOUT}
    +     *
    +     * @param cxnString
    +     *            connection string in the form of host:port
    +     * @param sessionTimeout
    +     * @throws IOException
    +     *             in cases of network failure
    +     */
    +    public static ZooKeeper createZKClient(String cxnString, int sessionTimeout) throws
IOException {
    +        CountdownWatcher watcher = new CountdownWatcher();
    +        ZooKeeper zk = new ZooKeeper(cxnString, sessionTimeout, watcher);
    +        try {
    +            watcher.waitForConnected(CONNECTION_TIMEOUT);
    +        } catch (InterruptedException e) {
    +            Assert.fail("ZooKeeper client can not connect to " + cxnString);
    +        }
    +        catch (TimeoutException e) {
    +            Assert.fail("ZooKeeper client can not connect to " + cxnString);
    +        }
    +        return zk;
    +    }
     }
    --- End diff --
    
    Thanks Rakesh. 
    Changes LGTM, +1



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message