HBASE-5780 Fix race in HBase regionserver startup vs ZK SASL authentication (Shaneal)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1326814 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-04-16 21:55:57 +00:00
parent 705278ae46
commit 6858d30b13
1 changed files with 6 additions and 0 deletions

View File

@ -75,6 +75,12 @@ public abstract class ZooKeeperNodeTracker extends ZooKeeperListener {
* or {@link #getData(boolean)} to get the data of the node if it is available. * or {@link #getData(boolean)} to get the data of the node if it is available.
*/ */
public synchronized void start() { public synchronized void start() {
try {
ZKUtil.waitForZKConnectionIfAuthenticating(watcher);
} catch (InterruptedException e) {
throw new IllegalStateException("ZookeeperNodeTracker on " + this.node
+ " interuppted while waiting for SASL Authentication", e);
}
this.watcher.registerListener(this); this.watcher.registerListener(this);
try { try {
if(ZKUtil.watchAndCheckExists(watcher, node)) { if(ZKUtil.watchAndCheckExists(watcher, node)) {