 <p>You could use <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html" rel="nofollow">CountDownLatch</a></p> <p>In your main method, you could define how many threads you would have, inject it within each of your threads and wait for their completion. Once a thread completes, its would call countdown api and once all your thread completes, your main method can continue further.</p>