public static CompletableFuture<Void> allOf(Predicate<Throwable> ignoreError, CompletableFuture<?>... futures) {
    CompletableFuture<Void> allFuture = CompletableFuture.allOf(futures);
    return allFuture.handle((aVoid, t) -> {
      for (CompletableFuture<?> future : futures) {
        try {
          future.join();
        } catch (Throwable th) {
          if (ignoreError.test(th)) {
            // continue
          } else {
            throw th;
          }
        }
      }
      return null;
    });
  }
Returns a future that completes when all the futures futures are complete.
Returned future completes exceptionally if any future complete with a non-ignored error.
samza-core/src/main/java/org/apache/samza/util/FutureUtil.java