For the intra virtual machine parallelization I would look at the java.util.concurrent library.
Originally Posted by gcorro
You could do a
This can all be done with the functionality the java.util.concurrent library provides. The missing part is the distribution functionality. A proof of concept version would be easy to set up with Terracotta.
Future future1 = executor.submit(task1);
Future future2 = executor.submit(task1);
Future future3 = executor.submit(task1);
return "Oh dear... no reason to try further";
//the first 3 tasks indicated we should try the rest.
Future4 = executor.submit(task4);
Future5 = executor.submit(task5);
Future6 = executor.submit(task5);
... and now check again
A few of the other grid solutions (like Javaspaces) also make it easy to distribute the code over the nodes. I don't know if Terracotta provides a similar solution. There is other functionality missing from the example: persisting tasks, failover over tasks (resubmitting them when something fails) etc. You can create it all by hand, but this usually is the stuff grid solutions take care of (partially).
Java 7 is receiving some new functionality in the java.util.concurrent library: