I have a class that will run on two or more separate physical machines connected over a LAN. However, I don't want to do the final processing until all but one has completed its task.
The problem to solve is that the task takes too long on one machine, so I've split the input file to process and file transfered it to the separate machines.
I'm thinking that one machine will be the controller, to which all other machines will report when their task is done. When all have reported completion then the controller can perform the final processing and end.
Any suggestions on how I can get the different machines to collaborate like this?
I once worked on an app that was 7 programs on one desktop communicating by DDE. (Yeah, a long time ago.) The driver spawned the other 6 as new tasks. As each one initialized it sent a message to the driver that it was ready. The driver counted these messages and when it got 6 it enabled the main window. Primitive but it worked. If you have asynchronous communication - you give another machine a task and then chug along with your own stuff while it's working - it might be an option.
If you have synchronous communication - you give another machine a task and block until it replies - you can create a thread for each worker bee and then join on all those threads. When they all finish your main thread will continue. That doesn't read very well ... lemme know if it's interesting and I'll find an example.
As mentioned above you have a wealth of protocol choices ... sockets, RMI, XML/HTTP, etc. Probably ought to make that choice first as it will affect the others.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi