Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
1
Introduction
3
RMI - Terms
• Object Oriented
• Mobile Behavior
• Design Patterns
• Safe and Secure
• Easy to Write/Easy to Use
• Connects to Existing/Legacy Systems
• Write Once, Run Anywhere
• Distributed Garbage Collection
• Parallel Computing
6
Distributed Objects & Remote
Invocation
Objects that can receive remote method invocation are called
remote objects and they implement a remote interface.
Due to the possibility of independent failure of invoker and
invoked objects, RMI have different semantics from local
calls.
RPC is to RMI as procedure call is to object invocation.
7
RMI - Architecture
8
RMI - Architecture
9
RMI - Architecture
• Responsibilities of the stub • Responsibilities of the
• On client side, stub does the skeleton
following: • On the server, the skeleton,
– Initiating remote calls – Unmarshals incoming
– Marshaling arguments to be arguments
sent – Calling the actual
– Informing the remote reference remote object
layer that a call should be implementation
invoked on the server – Marshaling return
– Unmarshalling a return value values for transport to
(or exception) the client
– Informing the remote reference
layer that the call is complete
10
RMI - Architecture
11
RMI - Architecture
• Transport Layer
• The Transport Layer makes the connection between JVMs.
• All connections are stream-based network connections
that use TCP/IP.
• Even if two JVMs are running on the same physical
computer, they connect through their host computer's
TCP/IP network protocol stack.
• The following diagram shows the unfettered use of TCP/IP
connections between JVMs.
12
RMI - RMI Registry
• The RMI registry provides the registry services for the server to
register the object and for the client to locate the object
Registry
13
class provides the methods for binding and obtaining references to
remote objects in a remote object registry.
Design Issues for RMI
The two design issues that arise in RMI are:
The choice of invocation semantics
There is no problem to call local invocations but in remote
invocation the problem of exception may arise like object
not found, object registered, time out, connection failure,
mismatch in semantics etc.
14
RMI invocation semantics
The Request- reply protocols that do Operation can be
implemented in different ways to provide different delivery
guarantees. The main choice are:
Retry request message: whether to retransmit the request
message until either a reply is received or the server is assumed
to have failed.
Duplicate filtering: when retransmission are used, whether to
filter out duplicate requests at the server.
Retransmission of results: whether to keep a history of result
messages to enable lost results to be retransmitted without re-
executing the operations at the server.
15
RMI invocation semantics
Combinations of these choices lead to a variety of possible
semantics for the reliability of remote invocations as seen by the
invoker. Table shows the choice of interest, with corresponding
names for the invocation semantics that they produce.
16
RMI invocation semantics / Policies
18
RMI - Working
19
RMI - Working
20
CORBA
• CORBA is the acronym for Common Object Request
Broker Architecture
• CORBA is a middleware design that allows application
programs to communicate with one another irrespective
of their programming languages, their hardware and
software platforms, the networks they communicate over
and their implementers.
• CORBA products provide a framework for the
development and execution of distributed applications.
• CORBA services provide generic facilities that may be of
use in a wide variety of applications, like
• Naming Service, the Event and Notification Services,
the Security Service, the Transaction and Concurrency
21
Services and the Trading Service.
CORBA - History
23
CORBA - Architecture
24
CORBA - Architecture
25
CORBA - Architecture
• ORB core: The role of the ORB core is similar to that of the
communication module . An ORB core provides an interface
that includes the following:
• operations enabling it to be started and stopped;
• operations to convert between remote object references
and strings;
• operations to provide argument lists for requests using
dynamic invocation.
• Portable object adapter: POA is the object adapters
• It is called portable because it allows applications and servants
• to be run on ORBs produced by different developers
• The POA supports CORBA objects with two different sorts of
lifetimes:
• Those whose lifetimes are restricted to that of the process
their servants are instantiated in;
• Those whose lifetimes can span the instantiations of servants
26
in multiple processes.
CORBA - Architecture
27
CORBA - Architecture
28
CORBA - Working
30