public void run()

in ratis-logservice/src/main/java/org/apache/ratis/logservice/tool/VerificationTool.java [344:382]


        public void run() {
            try {
                LogWriter writer = getLogWriter();
                for(int i = 0; i < numBatches; i++) {
                    List<ByteBuffer> messages = new ArrayList<ByteBuffer>(batchSize);
                    for(int j = 0; j < batchSize; j++) {
                        String message = MESSAGE_PREFIX + (i * batchSize + j);
                        messages.add(createValue(message));
                        if((i * batchSize + j) % getLogFreq() == 0) {
                            LOG.info(getLogName() + " batching write " + message);
                        }
                    }
                    try {
                        writer.write(messages);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }

                // Catch the last bit that didn't evenly fit into the batch sizes
                if (getNumRecords() % batchSize != 0) {
                  List<ByteBuffer> lastBatch = new ArrayList<>();
                  for (int i = numBatches * batchSize; i < getNumRecords(); i++) {
                    String message = MESSAGE_PREFIX + i;
                    lastBatch.add(createValue(message));
                  }
                  LOG.info(getLogName() + " writing last mini-batch of " + lastBatch.size() + " records");
                  try {
                    writer.write(lastBatch);
                  } catch (IOException e) {
                    throw new RuntimeException(e);
                  }
                }
                LOG.info("{} entries written in batches to {} successfully.",
                        getNumRecords(), getLogName());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }