How does the invokeAll() method of ExecutorService behave?

  • It executes all submitted tasks concurrently and returns a list of Future objects representing their results.
  • It executes all submitted tasks concurrently and returns the result of the first task that completes successfully.
  • It submits all tasks to the ExecutorService but returns only the first completed task's result.
  • It waits indefinitely until all tasks are completed, returning the results in the order they were submitted.
The invokeAll() method of ExecutorService takes a collection of Callable tasks, executes them concurrently, and returns a list of Future objects that represent the results. The order of the results matches the order of the tasks in the input collection. It doesn't return results as they complete; it waits for all tasks to finish and then returns the results.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *