[
https://issues.apache.org/jira/browse/ZOOKEEPER-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15833945#comment-15833945
]
ASF GitHub Bot commented on ZOOKEEPER-2671:
-------------------------------------------
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
> Fix compilation error in branch-3.4
> -----------------------------------
>
> Key: ZOOKEEPER-2671
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2671
> Project: ZooKeeper
> Issue Type: Bug
> Components: server
> Reporter: Arshad Mohammad
> Assignee: Arshad Mohammad
> Fix For: 3.4.10
>
> Attachments: ZOOKEEPER-2671-01.patch
>
>
> branch-3.4 code compilation is failing. Following are the compilation erros:
> {code}
> compile-test:
> [mkdir] Created dir: D:\gitHome\zookeeperTrunk\build\test\classes
> [javac] Compiling 146 source files to
> D:\gitHome\zookeeperTrunk\build\test\classes
> [javac] warning: [options] bootstrap class path not set in conjunction
> with -source 1.6
> [javac]
> D:\gitHome\zookeeperTrunk\src\java\test\org\apache\zookeeper\server\PurgeTxnTest.java:464:
> error: cannot find symbol
> [javac] ZooKeeper zk = ClientBase.createZKClient(HOSTPORT);
> [javac] ^
> [javac] symbol: method createZKClient(String)
> [javac] location: class ClientBase
> [javac]
> D:\gitHome\zookeeperTrunk\src\java\test\org\apache\zookeeper\server\PurgeTxnTest.java:503:
> error: cannot find symbol
> [javac] zk = ClientBase.createZKClient(HOSTPORT);
> [javac] ^
> [javac] symbol: method createZKClient(String)
> [javac] location: class ClientBase
> [javac] Note: Some input files use or override a deprecated API.
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)