Individual Practical (08-09): Java RMI
This page lists a variety of sources of documentation. I don't
expect you to read them all! Rather, you should find those
sources which you find most immediately useful, and refer to
others as your interests and your time available dictate. Please let
me know if you have suggestions for updates to this page.
Documentation from Sun
The
RMI
documentation home page on Sun's Java web site for the Java SE 6
release is a good place to start.
This documentation includes links to
- the RMI API pages,
- the Java RMI Specification,
- Several tutorials,
- other sources of information
Much of this documentation is too advanced for the needs of this course.
Below are pointers to useful parts of this documentation, along with
references to other sources that might be of interest.
Similar documentation is available with the J2SE 5.0 release from
Sun: very little changed in the RMI specifications between these
two releases.
Tutorials
The best place to start is the
Getting Started
tutorial. This covers almost all the features of Java RMI that are used
in the IP course.
If you want a tutorial that also includes some more background
material, try
Java
RMI trail of The Java Tutorial
Continued.
When reading through these tutorials (or any other you might find
by Googling on "Java RMI tutorial"), bear the following in mind:
- In our setup, all code is available to the local filesystem
of every JVM, so we don't need to dynamically download bytecode for
classes and we don't need to use security managers. In particular,
there is no need for setting the codebase parameter when
running our Java programs.
- Many examples talk about clients and servers being
distinct. This makes things simplest for explanation, but is not
necessary. In our peer-to-peer systems, every ChordNode and
DHashNode object behaves as both an RMI server and an RMI client.
However the JUnit test methods behave just as clients.
- Watch the date of tutorials. Older ones talk about rmic
compiler being used to generate stubs for the client ends of
RMI interactions and skeletons for the server ends. In Java 5.0
and Java 6, the use of rmic is unnecessary: both stubs and
skeletons are generated automatically. Otherwise, older tutorials
are still highly relevant since the overall principles have not
changed.
The Java RMI specification
The initial chapters of this provide a good introduction and
should be reasonably accessible. In particular, have a look at
sections 1.*, 2.*, 3.1 and 3.2. Ignore 3.3, 3.4 and 3.5: they are
not immediately relevant. You might also find 5.3 and 5.3.1 on the
UnicastRemoteObject class useful.
In reading this, note that the term remote object has a
technical meaning. It means any object from a class that
implements the Remote interface, and so can be invoked
from another JVM. It is not necessarily an object that exists in
some JVM distinct from a JVM being considered as the `local' JVM.
The RMI API pages
There is some information on these, but many are very terse and provide
little explanation. Most relevant are the API pages for:
- The Remote interface,
the RemoteException exception class in the
java.rmi package.
- The UnicastRemoteObject class
in the
java.rmi.server package.
- The Registry interface and the LocateRegistry
class in the
in the
java.rmi.registry package.
Papers
There are several papers on the Java RMI
architecture by its original architects. One written for a
general technical audience is:
Java-Centric Distributed Computing. Ann Wollrath, Jim
Waldo, Roger Riggs. IEEE Micro May/June 1997. Vol 17 no. 3. pp. 44-53.
This paper is held in the IEEE Xplore Electronic Library and is
accessible from within the
ed.ac.uk domain since the University
of Edinburgh subscribes to this library. It might not be electronically
accessible from outside.
Lectures
The Informatics 4th year and MSc Distributed Systems course has a
lecture on distributed objects and Java RMI. While it does
introduce Java RMI, you have to go to the book the lecture is based on
(Chapter 5 of
Distributed Systems: Concepts and Design,
G. Coulouris, J. Dollimore and T. Kindberg, Addison-Wesley, 2001, Third
Edition) for a walkthrough of the example given. Several copies of
this book are on reserve in the JCMB library
Paul Jackson,
Paul.Jackson (@) ed.ac.uk
Last modified: Wed Oct 1 11:57:43 BST 2008