Source:
public void execute() throws Exception { try { DataModel model = getParser().getDataModels().get(0); DataLoadTimeSummary dataLoadTimeSummary = new DataLoadTimeSummary(); DataLoadThreadTime dataLoadThreadTime = new DataLoadThreadTime(); for (Scenario scenario : getParser().getScenarios()) { List<Future> writeBatches = new ArrayList<Future>(); logger.info("\nLoading " + scenario.getRowCount() + " rows for " + scenario.getTableName()); long start = System.currentTimeMillis(); RowCalculator rowCalculator = new RowCalculator(getThreadPoolSize(), scenario.getRowCount()); for (int i = 0; i < getThreadPoolSize(); i++) { List<Column> phxMetaCols = pUtil.getColumnsFromPhoenix( scenario.getSchemaName(), scenario.getTableNameWithoutSchemaName(), pUtil.getConnection()); int threadRowCount = rowCalculator.getNext(); logger.info("Kick off thread (#" + i + ")for upsert with (" + threadRowCount + ") rows."); Future<Info> write = upsertData(scenario, phxMetaCols, scenario.getTableName(), threadRowCount, dataLoadThreadTime); writeBatches.add(write); } if (writeBatches.isEmpty()) { throw new PherfException( "Holy shit snacks! Throwing up hands in disbelief and exiting. Could not write data for some unknown reason."); } int sumRows = 0, sumDuration = 0; for (Future<Info> write : writeBatches) { Info writeInfo = write.get(); sumRows += writeInfo.getRowCount(); sumDuration += writeInfo.getDuration(); System.out .println("Executor writes complete with row count (" + writeInfo.getRowCount() + ") in Ms (" + writeInfo.getDuration() + ")"); } logger.info("Writes completed with total row count (" + sumRows + ") with total time of(" + sumDuration + ") Ms"); dataLoadTimeSummary.add(scenario.getTableName(), sumRows, (int) (System.currentTimeMillis() - start)); updatePhoenixStats(scenario.getTableName()); } resultUtil.write(dataLoadTimeSummary); resultUtil.write(dataLoadThreadTime); } finally { pool.shutdown(); } }

Target:
public void execute() throws Exception { try { DataModel model = getParser().getDataModels().get(0); DataLoadTimeSummary dataLoadTimeSummary = new DataLoadTimeSummary(); DataLoadThreadTime dataLoadThreadTime = new DataLoadThreadTime(); for (Scenario scenario : getParser().getScenarios()) { List<Future> writeBatches = new ArrayList<Future>(); logger.info("\nLoading " + scenario.getRowCount() + " rows for " + scenario.getTableName()); long start = System.currentTimeMillis(); RowCalculator rowCalculator = new RowCalculator(getThreadPoolSize(), scenario.getRowCount()); for (int i = 0; i < getThreadPoolSize(); i++) { List<Column> phxMetaCols = pUtil.getColumnsFromPhoenix( scenario.getSchemaName(), scenario.getTableNameWithoutSchemaName(), pUtil.getConnection()); int threadRowCount = rowCalculator.getNext(); logger.info("Kick off thread (#" + i + ")for upsert with (" + threadRowCount + ") rows."); Future<Info> write = upsertData(scenario, phxMetaCols, scenario.getTableName(), threadRowCount, dataLoadThreadTime); writeBatches.add(write); } if (writeBatches.isEmpty()) { throw new PherfException( "Holy shit snacks! Throwing up hands in disbelief and exiting. Could not write data for some unknown reason."); } int sumRows = 0, sumDuration = 0; for (Future<Info> write : writeBatches) { Info writeInfo = write.get(); sumRows += writeInfo.getRowCount(); sumDuration += writeInfo.getDuration(); logger.info("Executor writes complete with row count (" + writeInfo.getRowCount() + ") in Ms (" + writeInfo.getDuration() + ")"); } logger.info("Writes completed with total row count (" + sumRows + ") with total time of(" + sumDuration + ") Ms"); dataLoadTimeSummary.add(scenario.getTableName(), sumRows, (int) (System.currentTimeMillis() - start)); updatePhoenixStats(scenario.getTableName()); } resultUtil.write(dataLoadTimeSummary); resultUtil.write(dataLoadThreadTime); } finally { pool.shutdown(); } }