19-1 Remote Invocation-Remote Method Invocation
19-1 Remote Invocation-Remote Method Invocation
Applications, services
Remote invocation:
Request-Reply Protocols, Remote Procedure Calls Middleware
layers
Underlying inter-process communication
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)
• 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.
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.
• 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