HBASE-15803 ZooKeeperWatcher's constructor can leak a ZooKeeper instance with throwing ZooKeeperConnectionException when canCreateBaseZNode is true
This commit is contained in:
parent
76404238a8
commit
fad99a3f68
|
@ -181,7 +181,17 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
|
|||
this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, pendingWatcher, identifier);
|
||||
pendingWatcher.prepare(this);
|
||||
if (canCreateBaseZNode) {
|
||||
try {
|
||||
createBaseZNodes();
|
||||
} catch (ZooKeeperConnectionException zce) {
|
||||
try {
|
||||
this.recoverableZooKeeper.close();
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.debug("Encountered InterruptedException when closing " + this.recoverableZooKeeper);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
throw zce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue