@Override
      public MiniBatchOperationInProgress<Mutation>
        lockRowsAndBuildMiniBatch(List<RowLock> acquiredRowLocks) throws IOException {
        RowLock prevRowLock = null;
        for (byte[] row : rowsToLock) {
          try {
            RowLock rowLock = region.getRowLock(row, false, prevRowLock); // write lock
            if (rowLock != prevRowLock) {
              acquiredRowLocks.add(rowLock);
              prevRowLock = rowLock;
            }
          } catch (IOException ioe) {
            LOG.warn("Failed getting lock, row={}, in region {}", Bytes.toStringBinary(row), this,
              ioe);
            throw ioe;
          }
        }
        return createMiniBatch(size(), size());
      }
Perform atomic (all or none) mutations within the region.
@param mutations  The list of mutations to perform. <code>mutations</code> can contain
                  operations for multiple rows. Caller has to ensure that all rows are
                  contained in this region.
@param rowsToLock Rows to lock
@param nonceGroup Optional nonce group of the operation (client Id)
@param nonce      Optional nonce of the operation (unique random id to ensure "more
                  idempotence") If multiple rows are locked care should be taken that
                  <code>rowsToLock</code> is sorted in order to avoid deadlocks.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java