Lecture 25: Remote Method Invocation

Ambient temperature: 73.4oF

Concepts

  1. Remote Method Invocation (RMI): What if your adapters in the MVC architecture took their input, schlepped it across a network to another computer, talked to an object on that computer, got its response, and schlepped it back across the network to you, instead of the simple wrappers around the model or view that they’ve been in assignments thus far? Well, then you’d have RMI, a way to call methods and interact with objects on different computers, over a network, in a way that looks like those objects are actually sitting there on your own computer. Properly-set-up RMI frameworks can make it very easy to write programs that operate over a network.
  2. In an MVC setup, the Model may be another MVC trio. The view may be another MVC trio. The controller will usually not be an MVC trio. In an RMI setup, there may be two distinct MVC trios on either end of the network, or the Model and Controller may be on the server, with lots of Views as clients. MVC describes three components and how they interact; it doesn’t require that all three always appear together, nor that they appear only in sets of three.
  3. “The RMI Registry” is someplace that RMI clients can consult to find out “who is online, and how do I talk to them?” RMI Servers add themselves into the registry for a given lookup key. Then, clients can ask “Is there a ‘hello’ server?” instead of having to search all possible places that a server could be, and checking the type of each server (which is not a task that is actually possible).

Quotes

  1. Once I talk to the stub, the stub, like E.T., knows how to call home.” – Dr. Wong

Resources

  1. Lecture 25 Webpage: http://www.clear.rice.edu/comp310/f12/lectures/lec25/
  2. RMI Theory on COMP 310 webpage: http://www.clear.rice.edu/comp310/JavaResources/RMI/
  3. Oracle’s Tutorial on setting up RMI, complete with working sample code: http://docs.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html