Java ExecutorService: awaitTermination of all recursively created tasks

后端 未结 11 2129
太阳男子
太阳男子 2020-11-29 03:27

I use an ExecutorService to execute a task. This task can recursively create other tasks which are submitted to the same ExecutorService and those

11条回答
  •  一向
    一向 (楼主)
    2020-11-29 04:09

    Use a Future for your tasks (instead of submitting Runnable's), a callback updates it's state when it's completed, so you can use Future.isDone to track the sate of all your tasks.

提交回复
热议问题