Source:
public TaskResult run() { Pair<StatsSnapshot, StatsSnapshot> results = null; Exception exception = null; try { List<String> instanceNames = manager.getClusterManagmentTool().getInstancesInCluster(manager.getClusterName()); Map<String, StatsWrapper> statsWrappers = new HashMap<>(); for (String instanceName : instanceNames) { instanceName = stripPortNumber(instanceName); statsWrappers.put(instanceName, accountStatsStore.queryStatsOf(clusterMapConfig.clusterMapClusterName, instanceName)); } logger.info(String.format("Aggregating stats from %d hosts", statsWrappers.size())); results = clusterAggregator.doWorkOnStatsWrapperMap(statsWrappers, statsReportType); accountStatsStore.storeAggregatedStats(results.getSecond()); if (clusterMapConfig.clustermapEnableAggregatedMonthlyAccountReport && statsReportType == StatsReportType.ACCOUNT_REPORT) { String currentMonthValue = LocalDateTime.ofEpochSecond(time.seconds(), 0, ZONE_OFFSET).format(TIMESTAMP_FORMATTER); String recordedMonthValue = accountStatsStore.queryRecordedMonth(clusterMapConfig.clusterMapClusterName); if (recordedMonthValue == null || recordedMonthValue.isEmpty() || !currentMonthValue.equals( recordedMonthValue)) { logger.info("Taking snapshot of aggregated stats for month " + currentMonthValue); accountStatsStore.takeSnapshotOfAggregatedStatsAndUpdateMonth(clusterMapConfig.clusterMapClusterName, currentMonthValue); } } return new TaskResult(TaskResult.Status.COMPLETED, "Aggregation success"); } catch (Exception e) { logger.error("Exception thrown while aggregating stats from container stats reports across all nodes ", e); exception = e; return new TaskResult(TaskResult.Status.FAILED, "Exception thrown"); } finally { if (clusterMapConfig.clustermapEnableContainerDeletionAggregation && callback != null && results != null && statsReportType.equals(StatsReportType.ACCOUNT_REPORT)) { callback.onCompletion(results.getFirst(), exception); } } }

Target:
public TaskResult run() { Pair<StatsSnapshot, StatsSnapshot> results = null; Exception exception = null; try { List<String> instanceNames = manager.getClusterManagmentTool().getInstancesInCluster(manager.getClusterName()); Map<String, StatsWrapper> statsWrappers = new HashMap<>(); for (String instanceName : instanceNames) { instanceName = stripPortNumber(instanceName); statsWrappers.put(instanceName, accountStatsStore.queryStatsOf(clusterMapConfig.clusterMapClusterName, instanceName)); } logger.info("Aggregating stats from " + statsWrappers.size() + " hosts"); results = clusterAggregator.doWorkOnStatsWrapperMap(statsWrappers, statsReportType); accountStatsStore.storeAggregatedStats(results.getSecond()); if (clusterMapConfig.clustermapEnableAggregatedMonthlyAccountReport && statsReportType == StatsReportType.ACCOUNT_REPORT) { String currentMonthValue = LocalDateTime.ofEpochSecond(time.seconds(), 0, ZONE_OFFSET).format(TIMESTAMP_FORMATTER); String recordedMonthValue = accountStatsStore.queryRecordedMonth(clusterMapConfig.clusterMapClusterName); if (recordedMonthValue == null || recordedMonthValue.isEmpty() || !currentMonthValue.equals( recordedMonthValue)) { logger.info("Taking snapshot of aggregated stats for month " + currentMonthValue); accountStatsStore.takeSnapshotOfAggregatedStatsAndUpdateMonth(clusterMapConfig.clusterMapClusterName, currentMonthValue); } } return new TaskResult(TaskResult.Status.COMPLETED, "Aggregation success"); } catch (Exception e) { logger.error("Exception thrown while aggregating stats from container stats reports across all nodes ", e); exception = e; return new TaskResult(TaskResult.Status.FAILED, "Exception thrown"); } finally { if (clusterMapConfig.clustermapEnableContainerDeletionAggregation && callback != null && results != null && statsReportType.equals(StatsReportType.ACCOUNT_REPORT)) { callback.onCompletion(results.getFirst(), exception); } } }