111. Introduction to Java
RMI
Rev. 1.0
This one-day module offers a straightforward introduction to Java’s
Remote Method Invocation (RMI) framework. It is designed to teach experienced
Java programmers how to get up and running with RMI for practical applications.
The RMI architecture is discussed, and students work through a simple RMI
server implementation process: interface, implementation, and server. Then more
of the mechanics of RMI in practical use are studied, starting with a look at
some of the generated code for stubs and skeletons. This gives a better
understanding of the RMI marshaling process. Students then work on a more
complex system and confront design issues such as when and where to use remote
object references versus serialized state or value objects.
LEARNING OBJECTIVES
·
Understand the role of Java RMI in distributed Java
software development.
·
Understand the relationship between RMI and various
J2EE technologies such as JNDI, EJB, and CORBA.
·
Understand the RMI framework and architecture,
especially the role of generated stubs and skeletons.
·
Implement simple RMI clients and servers.
·
Know what files must be deployed to a client host for
the RMI client to function correctly, and likewise for an RMI server.
·
Understand the RMI marshaling process, especially what
sorts of method arguments and return values travel over the wire and which
remain to be referenced remotely.
·
Make well-motivated choices between remote objects and
serialized objects in RMI design and implementation.
Course Duration: 1
day.
Prerequisites:
Experience in Java Programming is essential. The student must be
comfortable with object-oriented Java, interfaces and abstract classes.
Knowledge of the Serialization API is important as well.
1. RMI
Architecture
Motivation for RMI
RMI and EJB
RMI and CORBA
Overview of RMI Architecture
Stubs and Skeletons
Remote Reference Layer
RMI Transport
Lifetime of a Remote Method Invocation
RMI Registry
Naming and URL Resolution
RMI Up and Running
2. RMI
Implementation
Interface Design
The Remote Interface
Implementation Classes
The RemoteObject and RemoteServer Classes
The UnicastRemoteObject Class
Server Implementation
Using the Registry
Client Implementation
Code Deployment
3. Practical
RMI
Stub Source Code
RMI Marshaling
Skeleton Source Code
Diagnostic Code Using RemoteServer
Passing Objects
The Factory Pattern
Serialization vs. Remote Reference
Designing for Latency
The Value Object Pattern
Exception Handling
Appendix A. References
System Requirements
Hardware (Recommended):
·
CPU: Pentium
200 or equivalent or faster
·
RAM: 64
MB (64 MB)
·
Disk: 200
MB (500 MB)
Software:
JDK version 1.2 or higher – 1.3 is recommended, preferably
with the Core API source code unpacked into directories and preferably with
full HTML documentation also installed. No commercial builder tools / IDEs are
required, but they can be used if preferred.