Distributed objects and remote invocation Pages
Objectives Models (RPC, RMI, ……) Interface – remote and service. Communications between objects - Remote method invocation. 3
4 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
Middleware layers 5 Applications Middleware layers Request reply protocol External data representation Operating System RMI, RPC and events invocation remote invocation remote local invocation A B C D E F Remote and local method invocations
Middleware Location transparency Communication protocols Computer hardware O.S. 6
Interface Interface - module (data, procedure) in general Interface – module in D.S. (input, output) 7 interface remote m1 m2 m3 m4 m5 m6 Data implementation remoteobject { of methods
8 Remote interface and Service interface Objects - each object has a remote object reference and a remote interface Service interface - client- server model. interface remote m1 m2 m3 m4 m5 m6 Data implementation remoteobject { of methods
Communications between D. objects Object model – reference, interface, actions, exception, garbage collection. Distributed object – program is partitioned, objects are logically partitioned Distribution, 9
Distributed object model reference, interface, actions, exception, garbage collection. 10 invocation remote invocation remote local invocation A B C D E F
Design issues for RMI Invocation semantics 11 Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure or retransmit reply No Yes Not applicable No Yes Not applicable Re-execute procedure Retransmit replyAt-most-once At-least-once Maybe
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 12
Home work Figure object A object B skeleton Request proxy for B Reply Communication Remote Remote referenceCommunication module reference module module for B’s class & dispatcher remote client server servant
14 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
15 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
Remote procedure call 16 client Request Reply Communication module dispatcher service client stub server stub procedure client processserver process procedure program