CIS 5930-04 – Spring 2001


Click here to start

Table of Contents

CIS 5930-04 – Spring 2001

Remote Method Invocation


Central Components of Java RMI

Some Supporting Technologies

Related Approaches to Networking


Getting Started

The Remote Interface

A Simple Example



The Remote Object

A Remote Object Implementation Class


Compiling the Remote Object Class

Client and Server Programs

A Server Program


A Client Program


Compiling and Running the Example

Running HelloClient/HelloServer

Running HelloClient/HelloServer

Running HelloClient/HelloServer

Running HelloClient/HelloServer

Running HelloClient/HelloServer

Remark on Using the RMI Registry

The Mechanics of Remote Method Invocation

Is RMI a Language Extension?

Exchanging Remote References

Example: a Printer Directory

Remote References have Interface Type


Some Important Parts of RMI


The Role of rmic

Example Operation of rmic

The Generated Stub Class

Remarks on the Stub Class

Marshalling of Arguments

Object Serialization

I/O Streams

Object Streams

Using Object Streams

Serialization Preserves Object Graphs

Serializing and Deserializing a Tree

Referential Integrity is Preserved

The Serializable Interface

Argument Passing in RMI

Passing by Remote Reference

Argument Passing Examples

Example: a File Reading Service

The Remote Interface

The Remote Object Implementation

The Server Program

The Client Program


Running FileClient/FileServer

Running FileClient/FileServer


Example: The RMI Registry

The RMI Registry

The Registry Remote Interface

The LocateRegistry Class

Using the Registry Interface Directly

Passing a Remote Object Argument


Dynamic Class Loading

Byte Code Instructions for Stubs?

Serialization Only Saves the Data

Copying Stub Class Files

Dynamic Class Loading

Dynamic Class Loading


The java.rmi.server.codebase Property


Setting the Code-base

Recap: Marshalling and the Code-base

Recap: Unmarshalling and Loading

Security Managers

Setting the Security Manager

Defining a Security Policy

The Property

Using Dynamic Loading

Anything that Can Go Wrong Will!

Tips for Dynamic Class Loading

Problems with the Registry

Empty CLASSPATH for the Registry

Using An “Internal” Registry

Collecting Things Together

The Server Program


A Client Program



Running FileClient/FileServer

Running FileClient/FileServer

Running FileClient/FileServer

Running FileClient/FileServer




Applets Today

Applets in this Course

Writing Applets is Easy (if . . .)

Applet Security Policies

Example: Application to Applet

The FileDisplay class

The FilePanel class

Conversion to an Applet

A First Attempt at an Applet Class

Compiling the Applet

Create an HTML File

Convert the HTML for the Plug-in

Make Sure the HTML is Visible!

Installing the Java Plug-in

Attempting to View the Applet

Adding a File Reading Service

An Updated File Server Program

An Updated Client

Deploying the Service

Class Loading in the Example

Running Server Programs in UNIX

What Did this Achieve?

Some Additional Features of Applets

Life Cycle of an Applet

Applet Parameters

An Improved Applet

An Improved Applet


Other Applications of RMI

Beyond Simple Client/Server

Example: Exploiting Dynamic Loading

A Generic Service

Example: Jini

Example: Call-backs

Server Remote Interface

Client Remote Interface

A Group of Interacting Objects

Sketch of Server Implementation

Sketch of Client Implementation


Garbage Collection

Author: Neil Jasper


Home Page: