java/kudu-client/src/test/java/org/apache/kudu/util/ClientTestUtil.java
public static int countRowsInScan(AsyncKuduScanner scanner, long timeoutMs) throws Exception {
    final AtomicInteger counter = new AtomicInteger();

    Callback<Object, RowResultIterator> cb = new Callback<Object, RowResultIterator>() {
      @Override
      public Object call(RowResultIterator arg) throws Exception {
        if (arg == null) return null;
        counter.addAndGet(arg.getNumRows());
        return null;
      }
    };

    while (scanner.hasMoreRows()) {
      Deferred<RowResultIterator> data = scanner.nextRows();
      data.addCallbacks(cb, defaultErrorCB);
      data.join(timeoutMs);
    }
    return counter.get();
  }
/**
   * Counts the rows from the {@code scanner} until exhaustion. It doesn't require the scanner to
   * be new, so it can be used to finish scanning a previously-started scan.
   */
Counts the rows from the  scanner until exhaustion. It doesn't require the scanner to
be new, so it can be used to finish scanning a previously-started scan.
Counts the rows from the scanner until exhaustion . It doesn ' t require the scanner to be new so it can be used to finish scanning a previously - started scan .
public static int countRowsInScan(AsyncKuduScanner scanner, long timeoutMs) throws Exception {
    final AtomicInteger counter = new AtomicInteger();
    Callback<Object, RowResultIterator> cb = new Callback<Object, RowResultIterator>() {
      @Override
      public Object call(RowResultIterator arg) throws Exception {
        if (arg == null) return null;
        counter.addAndGet(arg.getNumRows());
        return null;
      }
    };
    while (scanner.hasMoreRows()) {
      Deferred<RowResultIterator> data = scanner.nextRows();
      data.addCallbacks(cb, defaultErrorCB);
      data.join(timeoutMs);
    }
    return counter.get();
  }
public static int countRowsInScan ( AsyncKuduScanner scanner , long timeoutMs ) throws Exception { final AtomicInteger counter = new AtomicInteger ( ) ; Callback < Object , RowResultIterator > cb = new Callback < Object , RowResultIterator > ( ) { @ Override public Object call ( RowResultIterator arg ) throws Exception { if ( arg == null ) return null ; counter . addAndGet ( arg . getNumRows ( ) ) ; return null ; } } ; while ( scanner . hasMoreRows ( ) ) { Deferred < RowResultIterator > data = scanner . nextRows ( ) ; data . addCallbacks ( cb , defaultErrorCB ) ; data . join ( timeoutMs ) ; } return counter . get ( ) ; }
Counts the rows from the {@code scanner} until exhaustion.
Counts the rows from the { @code scanner } until exhaustion .