Distributed Systems Remote Procedure Call & Remote Method Invocation
1
Middleware Layers Applications RMI, RPC and events Request reply protocol
Middleware layers
External data representation Operating System
Distributed Systems
ccsejc, November 2003
2
Remote Procedure Call (RPC) Why RPC?
Sockets are considered low-level RPCs offer a higher-level form of communication
Client makes procedure call to “remote” server using ordinary procedure call mechanisms Distributed Systems
ccsejc, November 2003
3
Client and Server
Distributed Systems
ccsejc, November 2003
4
Binding in RPC
Distributed Systems
ccsejc, November 2003
5
Basic Concept of RPC
Distributed Systems
ccsejc, November 2003
6
Steps for RPC
Distributed Systems
ccsejc, November 2003
7
Issues in RPC Cannot pass pointers Weakly typed languages Not always possible to determine parameter types Cannot use global variables
Distributed Systems
ccsejc, November 2003
8
Remote Method Invocation Java’s version of RPC A thread may invoke a method on a remote object An object is considered “remote” if it resides in a separate Java Virtual Machine.
Distributed Systems
ccsejc, November 2003
9
Remote Method Invocation
Distributed Systems
ccsejc, November 2003
10
RPC versus RMI RPC’s support procedural programming style RMI supports object-oriented programming style Parameters to RPCs are ordinary data structures Parameters to RMI are objects Distributed Systems
ccsejc, November 2003
11
Object Model Object
Data Methods
Encapsulation Object Reference
unique identifier of object should not be reused
Distributed Systems
ccsejc, November 2003
12
Object Model Method Invocation
object reference + method name
Interface
types of arguments return values exceptions
Distributed Systems
ccsejc, November 2003
13
Distributed Objects Adopts client/server architecture May be replicated May be migrated May be accessed concurrently
Distributed Systems
ccsejc, November 2003
14
Distributed Objects
local
remote invocation A
Distributed Systems
B
C local E invocation invocation local invocation D
ccsejc, November 2003
remote invocation
F
15
Remote Object and Interface Remote Object Reference
unique can be used as arguments and results
Remote Interface
no constructors extend remote interface
Distributed Systems
ccsejc, November 2003
16
Remote Object and Interface remote object Data
remote interface
{
Distributed Systems
m1 m2 m3
implementation of methods
m4 m5 m6
ccsejc, November 2003
17
RMI Implementation server
client object A proxy for B
Request
skeleton & dispatcher for B’s class
remote object B
Reply
Communication Remote reference module module
Distributed Systems
Communication module
Remote reference module
ccsejc, November 2003
18
RMI Implementation Classes for proxies, skeleton, dispatchers Initialization Section (Server) Factory Methods Binder
Distributed Systems
ccsejc, November 2003
19
Events and Notifications Events
state change
Notification
allows object to respond to state changes
Distributed Systems
ccsejc, November 2003
20
Distributed Event-Based System Publish-Subscribe Paradigm
Publish type of events available (notification)
Subscribe registering interest
Heterogeneous Asynchronous Distributed Systems
ccsejc, November 2003
21
Dealing Room System External source
Dealer’s computer Dealer
Dealer’s computer
Notification
Notification
Notification
Information provider Notification
Notification
Dealer
Notification
Notification Dealer’s computer
Dealer’s computer Notification
Notification
Information provider Notification
Dealer
Dealer External source
Distributed Systems
ccsejc, November 2003
22
Distributed Event Notification Object of Interest Event Notification Subscriber Observer Objects (Event Monitor) Publisher
Distributed Systems
ccsejc, November 2003
23
Distributed Event Notification Event service subscriber
object of interest 1.
notification
object of interest 2. object of interest 3.
Distributed Systems
notification
observer
subscriber notification
observer
subscriber notification
ccsejc, November 2003
24