code: public void validateLock(long sessionId, long blockId, long lockId)
        throws BlockDoesNotExistException, InvalidWorkerStateException {
      synchronized (mSharedMapsLock) {
        LockRecord record = mLockIdToRecordMap.get(lockId);
        if (record == null) {
          throw new BlockDoesNotExistException(ExceptionMessage.LOCK_RECORD_NOT_FOUND_FOR_LOCK_ID,
              lockId);
        }
        if (sessionId != record.getSessionId()) {
          throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_SESSION,
              lockId, record.getSessionId(), sessionId);
        }
        if (blockId != record.getBlockId()) {
          throw new InvalidWorkerStateException(ExceptionMessage.LOCK_ID_FOR_DIFFERENT_BLOCK, lockId,
              record.getBlockId(), blockId);
        }
      }
    }
docs: Validates the lock is hold by the given session for the given block.
  
  @param sessionId the session id
  @param blockId the block id
  @param lockId the lock id
  @throws BlockDoesNotExistException when no lock record can be found for lock id
  @throws InvalidWorkerStateException when session id or block id is not consistent with that
  in the lock record for lock id