next up previous contents
Next: Handling MPJ aborts-Jini events Up: Process creation and monitoring Previous: The MPJ slave

The MPJ client

In pseudocode, the normal behaviour of the client is:

  create an `MPJClient' remote object for call-back by slaves

  discover Jini lookup services and create table, `daemons',
      of P remote references to suitable `MPJService' objects

  for i = 0..P-1 do {
    slaves [i] = daemons [i].createSlave(clientObject, ...) ;
  }

  create an instance, `task', of user's `MPJApplication' class

  for i = 0..P-1 in parallel threads do {
    slaves [i].runTask(task, args) ;
  }

  destroy slaves

The client must arrange for any byte code on the current CLASSPATH to be available via HTTP from a URL specified in the rmi.server.code.base property of the client JVM. In the usual way, this URL will be embedded in the serialized task object passed to the slave. A likely arrangement is for the client process itself to serve the necessary parts of the HTTP protocol.

In the normal case, the P threads terminate when the remote runTask methods all complete. The MPJ client process then terminates. As mentioned earlier, the client object provides a remote println method, which simply copies its argument to System.out.



Bryan Carpenter
Tue Nov 23 10:50:26 EST 1999