futures.add(dao.findAggregateMetricsAsync(scheduleId, bucket, begin, end));
}
ListenableFuture<List<ResultSet>> resultSetsFuture = Futures.successfulAsList(futures);
try {
List<ResultSet> resultSets = resultSetsFuture.get();
AggregateNumericMetricMapper mapper = new AggregateNumericMetricMapper();
List<AggregateNumericMetric> metrics = new ArrayList<AggregateNumericMetric>();
for (ResultSet resultSet : resultSets) {
metrics.addAll(mapper.mapAll(resultSet));
}
return metrics;
} catch (Exception e) {
log.warn("There was an error while fetching " + bucket + " data for {scheduleIds: " + scheduleIds +
", beginTime: " + begin + ", endTime: " + end + "}", e);