throws IOException {
Integer lid;
if (lockid == null) {
lid = internalObtainRowLock(row, waitForLock);
} else {
HashedBytes rowFromLock = lockIds.get(lockid);
if (!row.equals(rowFromLock)) {
throw new IOException("Invalid row lock: LockId: " + lockid + " holds the lock for row: " + rowFromLock + " but wanted lock for row: " + row);
}
lid = lockid;
}