I need to execute some amount of tasks 4 at a time, something like this:
ExecutorService taskExecutor = Executors.newFixedThreadPool(4);
while(...) {
tas
Follow one of below approaches.
submit on ExecutorService and check the status with blocking call get() on Future object as suggested by KiraninvokeAll() on ExecutorServiceshutdown, awaitTermination, shutdownNow APIs of ThreadPoolExecutor in proper sequence Related SE questions:
How is CountDownLatch used in Java Multithreading?
How to properly shutdown java ExecutorService