HBASE-5635 If getTaskList() returns null, splitlogWorker would go down and it won't serve any requests (Ram)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1329322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2012-04-23 16:47:04 +00:00
parent b854d1efb1
commit e2cd675020
1 changed files with 21 additions and 15 deletions

View File

@ -469,25 +469,31 @@ public class SplitLogWorker extends ZooKeeperListener implements Runnable {
private List<String> getTaskList() {
for (int i = 0; i < zkretries; i++) {
List<String> childrenPaths = null;
long sleepTime = 1000;
// It will be in loop till it gets the list of children or
// it will come out if worker thread exited.
while (!exitWorker) {
try {
return (ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
this.watcher.splitLogZNode));
childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(this.watcher,
this.watcher.splitLogZNode);
if (childrenPaths != null) {
return childrenPaths;
}
} catch (KeeperException e) {
LOG.warn("Could not get children of znode " +
this.watcher.splitLogZNode, e);
LOG.warn("Could not get children of znode "
+ this.watcher.splitLogZNode, e);
}
try {
Thread.sleep(1000);
LOG.debug("Retry listChildren of znode " + this.watcher.splitLogZNode
+ " after sleep for " + sleepTime + "ms!");
Thread.sleep(sleepTime);
} catch (InterruptedException e1) {
LOG.warn("Interrupted while trying to get task list ...", e1);
Thread.currentThread().interrupt();
return null;
}
}
}
LOG.warn("Tried " + zkretries + " times, still couldn't fetch " +
"children of " + watcher.splitLogZNode + " giving up");
return null;
return childrenPaths;
}