diff --git a/src/main/java/de/tum/bgu/msm/util/concurrent/ConcurrentExecutor.java b/src/main/java/de/tum/bgu/msm/util/concurrent/ConcurrentExecutor.java index 8e0b8775..1c7401b9 100644 --- a/src/main/java/de/tum/bgu/msm/util/concurrent/ConcurrentExecutor.java +++ b/src/main/java/de/tum/bgu/msm/util/concurrent/ConcurrentExecutor.java @@ -69,8 +69,17 @@ public T submitTaskAndWaitForCompletion(Callable task) { public List> execute() { try { - return service.invokeAll(tasks); - } catch (InterruptedException e) { + List> futures = service.invokeAll(tasks); + //The Following is needed to query each future at least once even + //if no particular result is needed. Otherwise exceptions that + //appeared during the execution are not caught and just silently + //ignored + //TODO: Implement utils for Runnables instead of Callables + for(Future future: futures) { + future.get(); + } + return futures; + } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } finally { service.shutdownNow();