public void resolveLock()

in modules/core/src/main/java/org/apache/fluo/core/impl/SnapshotScanner.java [160:213]


    public void resolveLock(Entry<Key, Value> lockEntry) {

      // read ahead a little bit looking for other locks to resolve

      long startTime = System.currentTimeMillis();
      long waitTime = INITIAL_WAIT_TIME;

      List<Entry<Key, Value>> locks = new ArrayList<>();
      locks.add(lockEntry);
      int amountRead = 0;
      int numRead = 0;

      RowColumn origEnd = snapIterConfig.getSpan().getEnd();
      boolean isEndInclusive = snapIterConfig.getSpan().isEndInclusive();

      while (true) {
        while (iterator.hasNext()) {
          Entry<Key, Value> entry = iterator.next();

          if (ColumnType.from(entry.getKey()) == ColumnType.LOCK) {
            locks.add(entry);
          }

          amountRead += entry.getKey().getSize() + entry.getValue().getSize();
          numRead++;

          if (numRead > 100 || amountRead > 1 << 12) {
            break;
          }
        }

        boolean resolvedLocks = LockResolver.resolveLocks(env, startTs, stats, locks, startTime);

        if (!resolvedLocks) {
          UtilWaitThread.sleep(waitTime);
          stats.incrementLockWaitTime(waitTime);
          waitTime = Math.min(MAX_WAIT_TIME, waitTime * 2);

          RowColumn start = SpanUtil.toRowColumn(locks.get(0).getKey());
          RowColumn end = SpanUtil.toRowColumn(locks.get(locks.size() - 1).getKey()).following();

          resetScanner(new Span(start, true, end, false));

          locks.clear();

        } else {
          break;
        }
      }

      RowColumn start = SpanUtil.toRowColumn(lockEntry.getKey());

      resetScanner(new Span(start, true, origEnd, isEndInclusive));
    }