Information Technology Reference
In-Depth Information
5.4 RMI Protocol Implementation
RMI is a Java-centric distributed system that is used as the protocol for Enterprise
JavaBeans (EJB) [103], Jini [117] and JavaSpaces [40]. The RMI framework is
very intrusive in nature, as it requires developers to be aware of remote objects
and remote errors that may occur while interacting with remote objects. This
intrusiveness manifests itself in the need for RMI applications to follow both a
programming convention and a programming framework.
The RMI programming conventions are as follows:
• The methods that are to be made available to remote clients must be declared
in an interface that extends java.rmi.Remote .
• These methods must be declared to throw the java.rmi.RemoteException
exception.
• RMI uses Java's object serialization to marshal and unmarshal parameters
and return values, which encodes objects and any objects they refer to, into a
byte stream for transmission from one virtual machine to another. Once the
byte stream is received, it is converted into the original object using a process
known as deserialization. RMI therefore requires that all objects and any
objects they reference that are used as parameters or return values implement
the java.io.Serializable interface, a marker interface that indicates to the
serialization system that they may be safely converted to a byte stream.
In addition, the developer is required to use RMI framework classes to:
• Access the RMI registry.
• Bindanobjecttotheregistry.
• Remove an object from the registry.
• Find an object in the registry.
• Export an object either implicitly, by extending the
java.rmi.server.UnicastRemoteObject class, or explicitly by exporting
the object using the exportObject method of the same class.
5.4.1
RMI Protocol Implementation Overview
Our RMI implementation is contained in a single class, RMIProtocol ,whichex-
tends from the abstract Protocol class, described in Section 5.2.TheRMIimple-
mentation supports the following options defined in the options DDL statement:
registryName. Defines the name of the remote service that is bound in the RMI
registry. It is used by the generated server as the name of the remote service
and by clients to locate the remote service.
registryHost. Defines the name of the host where the service is to be run. This
option is used by clients, together with the registryName option above and
the registryPort option below, to locate and bind to the remote service.
It may be overridden by defining an alternate host, or a list of hosts con-
taining the same service, on the command line or in the recovery statement
Search WWH ::




Custom Search