-
-
Save JohannesSundqvist/4901f0ebfc963f6a0ce92a25aff1292d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, List<Observation>> result = new TreeMap<String, List<Observation>>(); | |
ExecutorService e = Executors.newCachedThreadPool(); | |
for(Map.Entry<String, Map<LocalDate, Integer>> item : observations.entrySet()) { | |
Future<List<Observation>> f = e.submit(new GetObservationPart(start, end, item)); | |
if(f.isDone()) { | |
Future<Map<String, List<Observation>>> f2 = e.submit(new MergeObservationParts(result, item.getKey(), f.get())); | |
if(f2.isDone()) { | |
result = f2.get(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment