is invokeAll() a blocking call in java 7

后端 未结 2 1839
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 10:15
ExecutorService executorService = Executors.newSingleThreadExecutor();

Set> callables = new HashSet>();

c         


        
2条回答
  •  既然无缘
    2021-01-18 11:04

    You mean if the parent thread will wait for all the thread created using your ExecutorService invocation? Then answer is yes, parent thread will wait and once all threads are finished you will get the list of Futures object which will hold the result of each thread execution.

    See below from ExecutorService.invokeAll()

    Executes the given tasks, returning a list of Futures holding their status and results when all complete.

提交回复
热议问题