public static List<Response> waitForAll(Collection<FutureResponse> tasks, long timeout) {

        // Copy the list in case it is modified while we are waiting
        List<FutureResponse> workingTasks = new ArrayList<>(tasks);
        @SuppressWarnings({"rawtypes", "unchecked"})
        Future task = getFuture(new Callable() {
            @Override
            public List<Future> call() {
                for (FutureResponse task : workingTasks) {
                    task.get();
                }
                return null;
            }
        });

        try {
            task.get(timeout, TimeUnit.MILLISECONDS);
        } catch (TimeoutException | InterruptedException | ExecutionException e) {
            // Handle timeouts below
        }

        List<Response> responses = new ArrayList<>(tasks.size());
        for (FutureResponse future : workingTasks)
            responses.add(getTaskResponse(future));
        return responses;
    }
Performs an async processing. Note that the given request cannot be simultaneously
used in multiple such processings - a clone must be created for each.
container-core/src/main/java/com/yahoo/processing/execution/AsyncExecution.java