private boolean lock(String[] paths, int index, HiveLockObjectData data, boolean exclusive) {
      if (!lock.tryLock()) {
        return false;
      }
      try {
        if (index == paths.length) {
          if (this.exclusive || exclusive && hasLock()) {
            return false;
          }
          set(data, exclusive);
          return true;
        }
        Node child;
        if (children == null) {
          children = new HashMap<String, Node>(3);
          children.put(paths[index], child = new Node());
        } else {
          child = children.get(paths[index]);
          if (child == null) {
            children.put(paths[index], child = new Node());
          }
        }
        return child.lock(paths, index + 1, data, exclusive);
      } 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