What is the simplest way to to wait for all tasks of ExecutorService to finish? My task is primarily computational, so I just want to run a large number of jobs
ExecutorService
If you want to wait for all tasks to complete, use the shutdown method instead of wait. Then follow it with awaitTermination.
wait
Also, you can use Runtime.availableProcessors to get the number of hardware threads so you can initialize your threadpool properly.