This preview shows page 1. Sign up to view the full content.
Unformatted text preview: istry is simply a name repository. It does not address the problem of actually
invoking the remote method.
The two objects may physically reside on different machines. A mechanism is needed to
transmit the client's request to invoke a method on the server object to the server object and
provide a response. RMI uses an approach similar to RPC in this regard. An RMI compiler
called rmic, which is part of the JDK, must process the code for the server object.
The rmic compiler generates two files: a stub and a skeleton. The stub resides on the client
machine and the skeleton resides on the server machine. The stub and skeleton are
comprised of Java code that provides the necessary link between the two objects.
When a client invokes a server method, the JVM looks at the stub to do type checking (since
the class defined within the stub is an image of the server class). The request is then routed
to the skeleton on the server, which in turn calls the appropriate method on the server object.
In other words, the stub acts as a proxy to the skeleton and the skeleton is a proxy to the
actual remote method. The first layer is the Stub/Skeleton Layer. This layer is responsible for managing the remote
object interface between the client and server.
The second layer is the Remote Reference Layer (RRL). This layer is responsible for
managing the "liveliness" of the remote objects. It also manages the communication between
the client/server and virtual machines, (e.g., threading, garbage collection, etc.) for remote
The third layer is the Transport Layer. This is the actual network/communication layer that is
used to send the information between the client and server over the wire. It is currently
TCP/IP based. Java RMI Architecture
The design goal for the RMI architecture was to create a Java distributed object model that
integrates naturally into the Java programming language and the local object model. RMI
architects have succeeded; creating a system that extends the safety and robustness of the Java
architecture to the distributed computing world.
Interfaces: The Heart of RMI
The RMI architecture is based on one important principle: the definition of behavior and the
implementation of that behavior are separate concepts. RMI allows the code that defines the
behavior and the code that implements the behavior to remain separate and to run on separate
JVMs. 3 Manisha Akolkar INTERNATIONAL INSTITUTE OF INFORMATION TECHNOLOGY
P-14, Pune Infotech Park, Hinjaw adi, Pune – 411 027
This fits nicely with the needs of a distributed system where clients are concerned about the
definition of a service and servers are focused on providing the service.
Specifically, in RMI, the definition of a remote service is coded using a Java interface. The
implementation of the remote service is coded in a class. Therefore, the key to understanding
RMI is to remember that interfaces define behavior and classes define implementation.
While the following diagram illustrates this separation, remember that a Java in...
View Full Document
This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.
- Summer '10