My Question: How to execute a bunch of threaded objects on a ThreadPoolExecutor and wait for them all to finish before moving on?
I\'m new to Thread
Try this,
ThreadPoolExecutor ex = new ThreadPoolExecutor(limit, limit, 20, TimeUnit.SECONDS, q); for (int i = 0; i < limit; i++) { ex.execute(new RunnableObject(i + 1)); }
Lines to be added
ex.shutdown(); ex.awaitTermination(timeout, unit)