HBASE-9746 Addendum.
This commit is contained in:
parent
aada70053b
commit
e27a427f9b
|
@ -130,7 +130,7 @@ public class RecoverableZooKeeper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to create a Zookeeper connection. Turns any exception encountered into a
|
* Try to create a Zookeeper connection. Turns any exception encountered into a
|
||||||
* {@link KeeperException.OperationTimeoutException} so it can retried.
|
* KeeperException.OperationTimeoutException so it can retried.
|
||||||
* @return The created Zookeeper connection object
|
* @return The created Zookeeper connection object
|
||||||
* @throws KeeperException
|
* @throws KeeperException
|
||||||
*/
|
*/
|
||||||
|
@ -138,8 +138,8 @@ public class RecoverableZooKeeper {
|
||||||
if (this.zk == null) {
|
if (this.zk == null) {
|
||||||
try {
|
try {
|
||||||
this.zk = new ZooKeeper(quorumServers, sessionTimeout, watcher);
|
this.zk = new ZooKeeper(quorumServers, sessionTimeout, watcher);
|
||||||
} catch (Exception uhe) {
|
} catch (IOException ex) {
|
||||||
LOG.warn("Unable to create ZooKeeper Connection", uhe);
|
LOG.warn("Unable to create ZooKeeper Connection", ex);
|
||||||
throw new KeeperException.OperationTimeoutException();
|
throw new KeeperException.OperationTimeoutException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,8 @@ public class RecoverableZooKeeper {
|
||||||
LOG.info("Closing dead ZooKeeper connection, session" +
|
LOG.info("Closing dead ZooKeeper connection, session" +
|
||||||
" was: 0x"+Long.toHexString(zk.getSessionId()));
|
" was: 0x"+Long.toHexString(zk.getSessionId()));
|
||||||
zk.close();
|
zk.close();
|
||||||
|
// reset the Zookeeper connection
|
||||||
|
zk = null;
|
||||||
}
|
}
|
||||||
checkZk();
|
checkZk();
|
||||||
LOG.info("Recreated a ZooKeeper, session" +
|
LOG.info("Recreated a ZooKeeper, session" +
|
||||||
|
|
Loading…
Reference in New Issue