0% found this document useful (0 votes)
45 views13 pages

19-1 Remote Invocation-Remote Method Invocation

This document discusses remote method invocation (RMI) and related concepts: 1) RMI allows objects to invoke methods on remote objects by passing a remote object reference. It provides transparency by using the same syntax for local and remote calls. 2) Every remote object has a remote interface specifying which methods can be invoked remotely. The remote object reference uniquely identifies the remote object. 3) Remote objects are instantiated by invoking a factory method that returns a remote object reference. This reference can then be used to invoke methods on the remote object. 4) RMI supports exceptions for errors related to distribution, as well as exceptions raised during method execution. This allows clean error handling.

Uploaded by

amal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views13 pages

19-1 Remote Invocation-Remote Method Invocation

This document discusses remote method invocation (RMI) and related concepts: 1) RMI allows objects to invoke methods on remote objects by passing a remote object reference. It provides transparency by using the same syntax for local and remote calls. 2) Every remote object has a remote interface specifying which methods can be invoked remotely. The remote object reference uniquely identifies the remote object. 3) Remote objects are instantiated by invoking a factory method that returns a remote object reference. This reference can then be used to invoke methods on the remote object. 4) RMI supports exceptions for errors related to distribution, as well as exceptions raised during method execution. This allows clean error handling.

Uploaded by

amal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Institute of Computer Science

Department of Mathematics and Computer Science

Algorithms and Programming IV


Remote Invocation:
Remote Method Invocation (19-1)
Summer Term 2020 | 24.06.2020
Claudia Müller-Birn, Barry Linnert
Middleware Layers

Applications, services

Remote invocation:
Request-Reply Protocols, Remote Procedure Calls Middleware
layers
Underlying inter-process communication

UDP and TCP

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 2
Our Topics Today
• Properties of Remote Object Invocation

• Implementation of RMI

• Java RMI

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 3
Remote Call Variantes
Remote procedure call (RPC)
• A procedure is called (typically part of a module) for procedural languages (e.g.,
Modula, C)
• Also for heterogeneous infrastructures, e.g. Distributed Computing Environment
(DCE)

Remote object invocation (ROI)


• For object-oriented languages (e.g., Java, C++, C#), where an operation/method
of an object is called.
• In Java it is called Remote Method Invocation (RMI) and in C# ".NET Remoting"
• Also for heterogeneous infrastructures, e.g. CORBA
ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 4
Commonalities of ROI and RPC
• Support of programming languages with interfaces.

• Both are typically constructed on top of the request-reply protocol and it offers a
number of call semantics (exactly once, at most once, and at least once).

• Offer a similar level of transparency, means local and remote calls employ the
same syntax, but remote interfaces expose the distributed nature for example by
supporting remote exceptions.

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 5
Remote invocation
REMOTE OBJECT INVOCATION

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 6
Remote and Local Method Invocation

remote local C
E
invocation invocation local
invocation remote
invocation F
A B local
invocation D

Remote object reference: Other objects can invoke the methods of a remote object
if they have access to its remote object reference.

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 7
Remote Object Reference

The remote object reference is an identifier for a remote object that is valid
throughout the distributed system. It is passed in the invocation message to specify
which object is to be invoked.

32 bits 32 bits 32 bits 32 bits


Internet
port number time object number interface of
address remote object

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 8
Remote and Local Method Invocation

remote local C
E
invocation invocation local
invocation remote
invocation F
A B local
invocation D

Remote object reference: Other objects can invoke the methods of a remote object
if they have access to its remote object reference.

Remote interface: Every remote object has a remote interface that specifies which of
its methods can be invoked remotely.

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 9
A Remote Object and its Remote Interface

remoteobject

Data
remote
interface
m1 m4

{
implementation m5
m2
of methods m6
m3

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 10
Instantiation of Remote Objects

remote local C
E
invocation invocation local
invocation remote
invocation F
A B local
invocation D

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 11
Instantiation of Remote Objects

remote local C
E
invocation invocation local
invocation remote
invocation F
A B local
invocation D

L
remote
remote
invocation instantiate instantiate
invocation K
C M N

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 12
Exceptions
• Any remote invocation may fail for reasons related to the invoked object being in a
different process or computer from the invoker.

• Remote method invocation should be able to raise exceptions such as timeouts


that are due to distribution as well as those raised during the execution of the
method invoked.

• Exceptions provide a clean way to deal with error conditions without complicating
the code. In addition, each method heading explicitly lists as exceptions the error
conditions it might encounter, allowing users of the method to deal with them.

ALP IV: Concepts of Non-Sequential and Distributed Programming | Summer Term 2020 13

You might also like