private boolean unlock(String[] paths, int index, HiveLockObjectData data) {
      if (!lock.tryLock()) {
        return false;
      }
      try {
        if (index == paths.length) {
          if (hasLock()) {
            datas.remove(data.getQueryId());
          }
          return true;
        }
        Node child = children == null ? null : children.get(paths[index]);
        if (child == null) {
          return true; // should not happen
        }
        if (child.unlock(paths, index + 1, data)) {
          if (!child.hasLock() && !child.hasChild()) {
            children.remove(paths[index]);
          }
          return true;
        }
        return false;
      } finally {
        lock.unlock();
      }
    }
shared lock manager for dedicated hive server. all locks are managed in memory
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/EmbeddedLockManager.java