in hbase-oss/src/main/java/org/apache/hadoop/hbase/oss/sync/ZKTreeLockManager.java [338:357]
private boolean isLocked(InterProcessMutex lock) throws IOException {
try {
if (lock.isOwnedByCurrentThread()) {
// First check the current thread, because we allow you to get locks
// when parent or child paths are only locked by you.
return false;
}
if (lock.isAcquiredInThisProcess()) {
// We know it's not this thread, but this is less expensive
// than checking other processes.
return true;
}
return !lock.getParticipantNodes().isEmpty();
} catch (KeeperException.NoNodeException e){
return false;
} catch (Exception e) {
logCaller();
throw new IOException("Exception while testing a lock", e);
}
}