private List<HiveLock> lock(List<HiveLockObj> objs, int numRetriesForLock, long sleepTime)
      throws LockException {
    sortLocks(objs);
    if (LOG.isDebugEnabled()) {
      for (HiveLockObj obj : objs) {
        LOG.debug("Acquiring lock for {} with mode {}", obj.getObj().getName(),
            obj.getMode());
      }
    }

    for (int i = 0; i <= numRetriesForLock; i++) {
      if (i > 0) {
        sleep(sleepTime);
      }
      List<HiveLock> locks = lockPrimitive(objs, numRetriesForLock, sleepTime);
      if (locks != null) {
        return locks;
      }
    }
    return null;
  }
shared lock manager for dedicated hive server. all locks are managed in memory
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/EmbeddedLockManager.java