public static List parse() { CountDownLatch latch = new CountDownLatch(1000); for (int i = 1; i <= 1000; i++) { Executor executor = Executors.newFixedThreadPool(20); Parser thread = new Parser(latch); thread.setName(Integer.toString(i)); threadCount++; //increase the number of working threads executor.submit(thread); } latch.await(); return itemList; } public void run() { // jsut add the line after you code latch.countDown(); }