in hbase-oss/src/main/java/org/apache/hadoop/hbase/oss/sync/TreeLockManager.java [315:345]
protected void treeReadLock(Path path) throws IOException {
int outerRetries = 0;
long outerInitAttempt = System.currentTimeMillis();
do {
int innerRetries = 0;
long innerInitAttempt = System.currentTimeMillis();
do {
// If there's a write lock above us, wait
if (writeLockAbove(path)) {
if (warnIfAboveThreshold(innerInitAttempt,
"Blocked waiting for some parent write lock, waiting: {}", path.toString())){
innerInitAttempt = System.currentTimeMillis();
}
continue;
}
break;
} while (retryBackoff(innerRetries++));
// Try obtain the read-lock just for our node
readLock(path);
// If there's a write lock above us, release the lock and try again
if (writeLockAbove(path)) {
if (warnIfAboveThreshold(outerInitAttempt,
"Blocked waiting for some parent write lock, retrying: {}", path.toString())){
outerInitAttempt = System.currentTimeMillis();
}
readUnlock(path);
continue;
}
break;
} while (retryBackoff(outerRetries++));
}