Skip to content

Instantly share code, notes, and snippets.

@thabofletcher
Created March 27, 2015 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thabofletcher/b1cefe1529a019614721 to your computer and use it in GitHub Desktop.
Save thabofletcher/b1cefe1529a019614721 to your computer and use it in GitHub Desktop.
List<IOException> deserializationErrors = new ArrayList<IOException>();
IntStream.range(0, items.length)
.parallel()
.forEach(i -> {
String messageBody = messages.get(i).getBody();
try {
items[i] = mapper.readValue(messageBody, type);
} catch (IOException e) {
deserializationErrors.add(e);
}
});
if (deserializationErrors.size() > 0) {
throw new AggregateIOException(deserializationErrors);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment