code: public long runFor(final long duration, final TimeUnit unit) {
      final long deadline = System.currentTimeMillis() + unit.toMillis(duration);
      final ExecutorService es = Executors.newSingleThreadExecutor();
      final Future<Long> future = es.submit(this);
      try {
        while (System.currentTimeMillis() < deadline && !future.isDone()) {
          Thread.sleep(unit.toMillis(1));
        }
      } catch (final InterruptedException ignored) {
      } finally {
        stop();
      }
      final long result;
      try {
        result = future.get();
      } catch (final InterruptedException | ExecutionException ex) {
        throw new IllegalStateException(ex);
      } finally {
        es.shutdown();
      }
      return result;
    }
docs: Execute the verifier for the given duration.
  
  <p>
  This provides a simple way to execute the verifier for those applications
  which do not wish to manage threads directly.
  
  @param duration amount of time to execute
  @param unit     units used to express the duration
  @return number of database rows successfully verified