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
Add all threads in collection and submit it using invokeAll.
If you can use invokeAll method of ExecutorService, JVM won’t proceed to next line until all threads are complete.
Here there is a good example:
invokeAll via ExecutorService