public HiveLock lock(HiveLockObject key, HiveLockMode mode, int numRetriesForLock, long sleepTime)
      throws LockException {
    for (int i = 0; i <= numRetriesForLock; i++) {
      if (i > 0) {
        sleep(sleepTime);
      }
      HiveLock lock = lockPrimitive(key, mode);
      if (lock != null) {
        return lock;
      }
    }
    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