Github user chtyim commented on a diff in the pull request:

    https://github.com/apache/incubator-twill/pull/41#discussion_r32444480
  
    --- Diff: 
twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/DefaultZKClientService.java
 ---
    @@ -479,12 +498,26 @@ public void run() {
          * Creates a new ZooKeeper connection.
          */
         private ZooKeeper createZooKeeper() throws IOException {
    -      ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, this);
    +      ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, 
wrapWatcher(this));
           for (Map.Entry<String, byte[]> authInfo : authInfos.entries()) {
             zk.addAuthInfo(authInfo.getKey(), authInfo.getValue());
           }
           return zk;
         }
    +
    +    /**
    +     * Closes the given {@link ZooKeeper} if it is not null. If there is 
InterruptedException,
    +     * it will get logged.
    +     */
    +    private void closeZooKeeper(@Nullable ZooKeeper zk) {
    +      try {
    +        if (zk != null) {
    +          zk.close();
    +        }
    +      } catch (InterruptedException e) {
    --- End diff --
    
    added


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to