/ Published in: Java
A simple way to parallelize a for loop in Java. Wrapping each iteration (task) with a Runnable, executing them with an ExecutorService (to pool threads) and coordinating them with a simple CountDownLatch.
Due to Java's lack of closures, this simple scenario is rather verbose.
Due to Java's lack of closures, this simple scenario is rather verbose.
URL: http://java.sun.com/j2se/1.6.0/docs/api/java/util/concurrent/CountDownLatch.html