|
|
With RMI, a program in one JVM, called a client, can pass parameters to,
and execute a method in a Java program on a different JVM, called the server.
-
However, these are not always the traditional definition of client and
server that we consider. The server can do the same to the client,
in which case the roles and names are switched. A client does not
necessarily have to be a PC, it can be another server.
-
How do we call a method and pass parameters to a JVM on an entirely different
machine?
-
We have to have something to marshall and unmarshall our
request.
-
Marshalling converts our Java object to bytes, and send these bytes in
a stream over the network.
-
Unmarshalling does the opposite - it converts the bytes back to objects
again.
-
This occurs on both sides, when the method is called, and when the results
are returned.
-
The good news is, Java takes care of most of this work for us. We
just have to use some interfaces, ala the proxy
design pattern.
(In class: Draw a sequence diagram to represent this.)
Marshalling with Stubs
|