Source:
public Future<Info> upsertData(final Scenario scenario, final List<Column> columns, final String tableName, final int rowCount, final DataLoadThreadTime dataLoadThreadTime) { Future<Info> future = pool.submit(new Callable<Info>() { @Override public Info call() throws Exception { int rowsCreated = 0; long start = 0, duration, totalDuration; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Connection connection = null; try { connection = pUtil.getConnection(); long logStartTime = System.currentTimeMillis(); long maxDuration = (WriteWorkload.this.writeParams == null) ? Long.MAX_VALUE : WriteWorkload.this.writeParams.getExecutionDurationInMs(); for (long i = rowCount; (i > 0) && ((System.currentTimeMillis() - logStartTime) < maxDuration); i--) { String sql = buildSql(columns, tableName); PreparedStatement stmt = connection.prepareStatement(sql); stmt = buildStatement(scenario, columns, stmt, simpleDateFormat); start = System.currentTimeMillis(); rowsCreated += stmt.executeUpdate(); stmt.close(); if ((i % getBatchSize()) == 0) { connection.commit(); duration = System.currentTimeMillis() - start; logger.info("Writer (" + Thread.currentThread().getName() + ") committed Batch. Total " + tableName + " rows for this thread (" + this.hashCode() + ") in (" + duration + ") Ms"); if (i % PherfConstants.LOG_PER_NROWS == 0 && i != 0) { dataLoadThreadTime .add(tableName, Thread.currentThread().getName(), i, System.currentTimeMillis() - logStartTime); logStartTime = System.currentTimeMillis(); } Thread.sleep(threadSleepDuration); } } } finally { if (connection != null) { try { connection.commit(); duration = System.currentTimeMillis() - start; logger.info("Writer ( " + Thread.currentThread().getName() + ") committed Final Batch. Duration (" + duration + ") Ms"); connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } totalDuration = System.currentTimeMillis() - start; return new Info(totalDuration, rowsCreated); } }); return future; }

Target:
public Future<Info> upsertData(final Scenario scenario, final List<Column> columns, final String tableName, final int rowCount, final DataLoadThreadTime dataLoadThreadTime) { Future<Info> future = pool.submit(new Callable<Info>() { @Override public Info call() throws Exception { int rowsCreated = 0; long start = 0, duration, totalDuration; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Connection connection = null; try { connection = pUtil.getConnection(); long logStartTime = System.currentTimeMillis(); long maxDuration = (WriteWorkload.this.writeParams == null) ? Long.MAX_VALUE : WriteWorkload.this.writeParams.getExecutionDurationInMs(); for (long i = rowCount; (i > 0) && ((System.currentTimeMillis() - logStartTime) < maxDuration); i--) { String sql = buildSql(columns, tableName); PreparedStatement stmt = connection.prepareStatement(sql); stmt = buildStatement(scenario, columns, stmt, simpleDateFormat); start = System.currentTimeMillis(); rowsCreated += stmt.executeUpdate(); stmt.close(); if ((i % getBatchSize()) == 0) { connection.commit(); duration = System.currentTimeMillis() - start; logger.info("Writer (" + Thread.currentThread().getName() + ") committed Batch. Total " + getBatchSize() + " rows for this thread (" + this.hashCode() + ") in (" + duration + ") Ms"); if (i % PherfConstants.LOG_PER_NROWS == 0 && i != 0) { dataLoadThreadTime .add(tableName, Thread.currentThread().getName(), i, System.currentTimeMillis() - logStartTime); logStartTime = System.currentTimeMillis(); } Thread.sleep(threadSleepDuration); } } } finally { if (connection != null) { try { connection.commit(); duration = System.currentTimeMillis() - start; logger.info("Writer ( " + Thread.currentThread().getName() + ") committed Final Batch. Duration (" + duration + ") Ms"); connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } totalDuration = System.currentTimeMillis() - start; return new Info(totalDuration, rowsCreated); } }); return future; }