SessionCache sessionCache = session.cache();
NodeCache cache = sessionCache;
NodeKey nodeKey = node.key();
NodeKey key = nodeKey;
while (key != null) {
ModeShapeLock lock = lockManager.findLockFor(key);
if (lock != null && (lock.isDeep() || nodeKey.equals(lock.getLockedNodeKey()))) {
// There is a lock that applies to 'node', either because the lock is actually on 'node' or because
// an ancestor node is locked with a deep lock...
return lock;
}
// Otherwise, get the parent, but use the cache directly ...