I think this algorithm is not elegant enough. How about we do like this:

```java
List<Throwable> failures;
for (Future f : futures) {
  Throwable t = f.get();
  if (t != null) {
    failures.add(t);
  }
}
if (!failures.isEmpty()) {
  throw new IllegalStateException(
    StringUtils.join(failures) // not sure about this line
  );
}
```

In your current code we'll get only one exception out. And we have to wait with `awaitTermination()`. In my example we don't terminate the executor, we don't wait for its end. All this will happen automatically, because we'll call `get()` methods on all futures.