Why would invokeAll() not return?
concurrency, java
Solution
Executes the given tasks, returning a list of Futures holding their status and results when all complete. the API
You have to `submit()` them one at a time instead, something like:
public static <T> List<Future<T>> submitAll ( ExecutorService executor, Collection<? extends Callable<T> > tasks ) {
List<Future<T>> result = new ArrayList<Future<T>>( tasks.size() );
for ( Callable<T> task : tasks )
result.add ( executor.submit ( task ) );
return result;
}
Problem
I have roughly this code: ``` ExecutorService threader = Executors.newFixedThreadPool(queue.size()); List futures = threader.invokeAll(queue); ``` I debug this and invokeAll doesn't seem to return until all the threads in the Queue are finished. Any reasons why this is happening.