File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Coordinating Processes Over Network Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Coordinating Processes Over Network" Watch "Coordinating Processes Over Network" New topic

Coordinating Processes Over Network

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
Hi All,

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?

Any different approaches?

Thank You in Advance for Your Help,

Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Have a look at rmi.
Or send a message over a socket.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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
I agree. Here's the link:
subject: Coordinating Processes Over Network
It's not a secret anymore!