示例#1
0
  public DomainEntityInfo execute(BatchCommand command) {
    long startTime = System.nanoTime();

    log.write(
        String.format(
            "Begin [%s Iterations: %s, BatchSize: %s]",
            command.description(), command.numberOfIterations(), command.batchSize()));
    command.onBegin(log);
    for (int index = 0; index < command.numberOfIterations(); index += command.batchSize()) {
      doExecute(index, command, startTime);
    }
    command.onEnd(log);
    log.write(String.format("End   [%s] %s\n", command.description(), elapsedTime(startTime)));

    return command.results();
  }
示例#2
0
 private static boolean indexIsInRange(int startIndex, BatchCommand command, int index) {
   return index < (startIndex + command.batchSize()) && index < command.numberOfIterations();
 }