Remote Method Invocation


RMI provides support for accessing Java classes on remote systems.Here is an example of Remote Method Invocation that allows us to access the Cso database on umslvma.umsl.edu. Sun Microsystems provides complete documentation on RMI in their

Remote Method Invocation Specification.

In addition to the creation of at least three classes, using RMI requires the performance of a number of steps. One of these involving the proper distribution of various files to the pararticipating systems. We will detail these steps, but first we will look at the source files used to generate the Cso query applet. They are

As stated by Sun Microsystems in its documentation mentioned above, "The goals for supporting distributed objects in the Java language are:

Quoting again from Sun's Remote Method Invocation Specification

"In the Java distributed object model, a remote object is one whose methods can be invoked from another Java Virtual Machine, potentially on a different host. An object of this type is described by one or more remote interfaces, which are Java interfaces that declare the methods of the remote object.

Remote method invocation (RMI) is the action of invoking a method of a remote interface on a remote object. Most importantly, a method invocation on a remote object has the same syntax as a method invocation on a local object.

The Distributed and Non-Distributed Models Contrasted

The Java distributed object model is similar to the Java object model in the following ways:

  • A reference to a remote object can be passed as an argument or returned as a result in any method invocation (local or remote).
  • A remote object can be cast to any of the set of remote interfaces supported by the implementation using the built-in Java syntax for casting.
  • The built-in Java instanceof operator can be used to test the remote interfaces supported by a remote object. The Java distributed object model differs from the Java object model in these ways:

    Next, here is Sun's description of the RMI architecture.

    Finally, the steps necessary to create the "Cso applet."

      javac *.java
      rmiregistry &
      rmic -d //accounts/faculty/siegel/public_html/java1.1/part5/rmi CsoImpl1
      java -Djava.rmi.server.codebase=http://jinx.umsl.edu/~siegel/java1.1/part5/rmi/ CsoImpl1 &
    
    Check for a more complete description.