in hbase-oss/src/main/java/org/apache/hadoop/hbase/oss/sync/ZKTreeLockManager.java [310:333]
private boolean readLockBelow(Path p, int level, int maxLevel) throws IOException {
try {
if (level > 0 && isLocked(get(p).readLock())) {
return true;
}
if (level < maxLevel) {
List<String> children = curator.getChildren().forPath(p.toString());
for (String child : children) {
if (child.equals(LOCK_SUB_ZNODE)) {
continue;
}
if (readLockBelow(new Path(p, child), level+1, maxLevel)) {
LOG.debug("Child read lock currently held: {}", p);
return true;
}
}
}
} catch (KeeperException.NoNodeException e) {
// Ignore, means we hit the bottom of the tree
} catch (Exception e) {
throw new IOException("Error checking children for read lock: " + p, e);
}
return false;
}