anmolnar commented on code in PR #5869:
URL: https://github.com/apache/hbase/pull/5869#discussion_r1589700781


##########
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java:
##########
@@ -41,7 +42,8 @@ public String parse(final Configuration c) {
    * ZooKeeper 3.4.6 broke being able to pass commands on command line. See 
ZOOKEEPER-1897. This
    * class is a hack to restore this faclity.
    */
-  private static class HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain extends 
ZooKeeperMain {
+  private static class HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain extends 
ZooKeeperMain
+      implements Closeable {

Review Comment:
   Probably not scope of this ticket, but 
[ZOOKEEPER-1897](https://issues.apache.org/jira/browse/ZOOKEEPER-1897) resolved 
long ago. Do we still need this class?



##########
hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperHelper.java:
##########
@@ -61,6 +61,7 @@ public static ZooKeeper ensureConnectedZooKeeper(ZooKeeper 
zookeeper, int timeou
     while (!zookeeper.getState().isConnected()) {
       Threads.sleep(1);
       if (stopWatch.elapsed(TimeUnit.MILLISECONDS) > timeout) {
+        zookeeper.close();

Review Comment:
   I suspect you added this to cover the case when constructor of 
`HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain` failes and close() not getting 
called. I think you might want to do this within the constructor by putting 
`ZooKeeperHelper.ensureConnectedZooKeeper(this.zk, 30000);` in a try-catch 
block to keep responsibility inside the class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to