The Parallelizer class is a Java thread utility that allows one to easily convert their serial code to parallel code. The class would typically be used to execute each iteration of a loop at once rather than one after another. Good candidates for such an optimization would be when the order of execution does not matter and each iteration does slow operations such as sleeping or making network connections.
To use the Parallelizer, a developer would typically:
Parallelizer pll = new Parallelizer();
for (int i=0; i<10; i++){
final int j = i;
pll.run(
new Runnable() {
@Override public void run() {
System.out.println("Hello World " + j);
}
}
);
}
pll.join();