next up previous contents
Next: The Child class Up: Communication infra-structure: Channels Previous: The Port class   Contents

The RPC class

The RPC class supports remote procedure calls. Its current interface is

  public class RPC {
    public static void call(String childClass, String remoteHost,
                            Port toChild) ;

    public static void spawn(String childClass, String remoteHost,
                             Port toChild) ;
  }
The call operation invokes a Java application on a remote processor, and sends a channel-end to it. childClass should be the name of a class derived from Child, with a main method. remoteHost should be the name of a host. toChild should be a port with a bound channel end. The call operation terminates when the remote call to main terminates. When the call completes, toChild is unconnected (the remote application is responsible for disposal of the channel-end it was initially sent).

spawn is similar, but invokes call in a new thread, so it returns immediately.

Typical usage would be

  // Create output channel

  Port R = new Port() ;
  Port S = new Port() ;

  Port.channel(R, S) ;

  // Spawn remote `Child' application

  RPC.spawn("EgChild", "koum", S) ;

  ... communicate with child through `R'.

The current implementation of RPC.call uses the Java exec mechanism to run the command

  rsh remoteHost java childClass
The remote host is a processor on which
  1. A remote shell can be executed
  2. The Java interpretter java is installed
  3. The byte-code for childClass is accessible through the CLASSPATH environment variable.
call transfers the channel-end through negotiations performed over the standard input and output streams of the remote process. Subsequent output from the child process is forwarded to the current process' standard output stream.


next up previous contents
Next: The Child class Up: Communication infra-structure: Channels Previous: The Port class   Contents
Bryan Carpenter 2002-07-12