[ 
https://issues.apache.org/jira/browse/HBASE-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998985#comment-12998985
 ] 

nilsk commented on HBASE-2791:
------------------------------

You should throw the InterruptedExceptions instead of swallowing it.

I just picked a sample from here 
[ZooKeeperWatcher|http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java?view=markup]

{code}
  /**
   * Close the connection to ZooKeeper.
   * @throws InterruptedException
   */
  public void close() {
    try {
      if (zooKeeper != null) {
        zooKeeper.close();
//        super.close();
      }
    } catch (InterruptedException e) {
    }
  }
{code}
Thats the worst thing you could do with an InterruptedException. Please see 
[this|http://www.ibm.com/developerworks/java/library/j-jtp05236.html] 

> Stop dumping exceptions coming from ZK and do nothing about them
> ----------------------------------------------------------------
>
>                 Key: HBASE-2791
>                 URL: https://issues.apache.org/jira/browse/HBASE-2791
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Jean-Daniel Cryans
>             Fix For: 0.90.0
>
>
> I think this is part of the Master/ZooKeeper refactoring project but I'm 
> putting it up here to be sure we cover it. Currently in ZKW (and other places 
> around the code base) we do ZK operations and we don't really handle the 
> exceptions, for example in ZKW.setClusterState:
> {code}
>     } catch (InterruptedException e) {
>       LOG.warn("<" + instanceName + ">" + "Failed to set state node in 
> ZooKeeper", e);
>     } catch (KeeperException e) {
>       if(e.code() == KeeperException.Code.NODEEXISTS) {
>         LOG.debug("<" + instanceName + ">" + "State node exists.");
>       } else {
>         LOG.warn("<" + instanceName + ">" + "Failed to set state node in 
> ZooKeeper", e);
>       }
> {code}
> This has been always like that since we started using ZK.
> What if the session was expired? What if it was only the connection that had 
> a blip? Do we handle it correctly? We need to have this discussion.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to