180 likes | 554 Views
Distributed objects and remote invocation. Pages 165 - 187 . Objectives . Models (RPC, RMI, ……) Interface – remote and service. Communications between objects - Remote method invocation. General models. Remote procedure call model (RPC)
E N D
Distributed objects and remote invocation Pages 165 - 187
Objectives • Models (RPC, RMI, ……) • Interface – remote and service. • Communications between objects - Remote method invocation.
General models • Remote procedure call model (RPC) • allows client programs to call procedures in server programs running in separate processes and computers • Remote method invocation (RMI) • allows an object living in one process to invoke methods of an object living in another process • Middelware • software that provides a programming model above the basic building blocks of processes and message passing
Applications RMI, RPC and events local C remote Middleware E local Request reply protocol invocation invocation layers remote invocation invocation F B External data representation local A invocation D Operating System Middleware layers Remote and local method invocations
Middleware • Location transparency • Communication protocols • Computer hardware • O.S.
remote object Data remote interface m4 { m1 implementation m5 m2 m6 of methods m3 Interface • Interface - module (data, procedure) in general • Interface – module in D.S. (input, output)
remote object Data remote interface m4 { m1 implementation m5 m2 m6 of methods m3 Remote interface and Service interface • Objects - each object has a remote object reference and a remote interface • Service interface - client- server model.
Communications between D. objects • Object model – reference, interface, actions, exception, garbage collection. • Distributed object – program is partitioned, objects are logically partitioned Distribution,
local C remote E local invocation invocation remote invocation invocation F B local A invocation D Distributed object model • reference, interface, actions, exception, garbage collection.
Invocation Fault tolerance measures semantics Retransmit request Duplicate Re-execute procedure message filtering or retransmit reply No Not applicable Not applicable Maybe Yes No Re-execute procedure At-least-once Yes Yes Retransmit reply At-most-once Design issues for RMI • Invocation semantics
Design issues for RMI (cont’d) • Exactly once semantics • every method is executed exactly once • At-least-once semantics • the invoker receives: either a result (method executed at least once) or an exception (no result received) • Transparency • remote calls look like local ones
Home work Figure 5.6 server client remote skeleton object B object A proxy for B Request & dispatcher for B’s class Reply servant Communication Communication Remote reference Remote module reference module module module
Implementation of RMI • Communication module • Request-Reply protocol, client-server model • Remote reference module • Responsible for translating between local and remote object references and creating remote object references
Implementation for RMI • The RMI software (self study) • Proxy: makes remote method invocation transparent to the invoker by behaving like a local object, forwards a message to a remote object • Dispatcher: receives the Request message, chooses the appropriate method in the skeleton and passes on the Request message • Skeleton: the class of a remote object has a skeleton which implements the methods in the remote interfaces. Unmarshals the arguments in the Request message, invokes the corresponding method in the remote object. Then waits for invocation to complete and marshals the result in a Reply message
client process server process Request Reply client stub server stub procedure procedure service client Communication Communication program procedure dispatcher module module Remote procedure call