private void doBatchSaveTest(final Consumer<List<SQLStatValSourceDO>> batchConsumer,
                                 final int batchSize,
                                 final int iterations) {
        final LogExecutionTime logExecutionTime = LogExecutionTime.start();
        for (int l = 0; l < iterations; l++) {
            final List<SQLStatValSourceDO> batch = new ArrayList<>();
            for (int i = 0; i < batchSize; i++) {
                long value = System.currentTimeMillis();
                long count = 100;

                final SQLStatValSourceDO statisticValueSource = SQLStatValSourceDO.createValueStat(
                        System.currentTimeMillis(),
                        "BATCHTEST" + i,
                        value,
                        count);

                batch.add(statisticValueSource);
            }

            LOGGER.logDurationIfInfoEnabled(() -> {
                batchConsumer.accept(batch);
            }, "Inserting " + batchSize + " stats");
        }
        LOGGER.info("Total time :" + logExecutionTime.getDuration()
                + " rate: "
                + ((double) batchSize) * iterations / logExecutionTime.getDurationMs() * 1000
                + "/sec");
    }
The aim of this test is for multiple threads to be flushing stats into SQL_STAT_VAL_SRC
and for the main thread to be constantly running the aggregation to exercise contention
on any db locks.
Useful for testing the performance of the two process when running concurrently.
stroom-app/src/test/java/stroom/statistics/impl/sql/TestSQLStatisticFlushTaskHandler.java