public boolean lockHeartbeat(final long procId, final boolean keepAlive) throws IOException {
      final LockProcedure proc =
        master.getMasterProcedureExecutor().getProcedure(LockProcedure.class, procId);
      if (proc == null) return false;

      master.getMasterCoprocessorHost().preLockHeartbeat(proc, keepAlive);

      proc.updateHeartBeat();
      if (!keepAlive) {
        proc.unlock(master.getMasterProcedureExecutor().getEnvironment());
      }

      master.getMasterCoprocessorHost().postLockHeartbeat(proc, keepAlive);

      return proc.isLocked();
    }
@param keepAlive if false, release the lock.
@return true, if procedure is found and it has the lock; else false.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java