Download presentation
Presentation is loading. Please wait.
1
Advanced Comm. between Distributed Objects 1 Advanced Communication Among Distributed Objects Outline Request synchronization Request multiplicity Request reliability
2
Advanced Comm. between Distributed Objects 2 Request Synchronization Request synchronization Synchronous Wait for the results Oneway Do not expect any results or exceptions Request returns control to client as soon as the middleware accepts the request Server and Client execute concurrently Deferred synchronous Dynamic Explicit request object Invoke more than one concurrent operations with single thread Asynchronous Callback from the server to client Non-synchronous requests can be achieved by synchronous requests and multi-threading COBRA provide direct support for all 4 different requests
3
Advanced Comm. between Distributed Objects 3 Oneway Request Using thread Spawn a child thread to make synchronous request Terminate the child thread once the request is finished Performance penalty
4
Advanced Comm. between Distributed Objects 4 Oneway Request Class PrintSquas { static void main(string[] args){ Team team; Date date; // initialization.. OnewayReq a = new OnewayReq (team, date); a.start(); // continue … } Class OnewayReq extends Thread { Team team; Date date; OnewayReq (Team t, Date d){ team = t; date = d;} public void run(){ team.print(date); // call remote method } Class PrintSquas { static void main(string[] args){ Team team; Date date; // initialization.. OnewayReq a = new OnewayReq (team, date); a.start(); // continue … } Class OnewayReq extends Thread { Team team; Date date; OnewayReq (Team t, Date d){ team = t; date = d;} public void run(){ team.print(date); // call remote method }
5
Advanced Comm. between Distributed Objects 5 Oneway Request Using thread Spawn a child thread to make synchronous request Terminate the child thread once the request is finished Performance penalty CORBA Static and dynamic invocation support oneway request IDL defines oneway operations Precondition: –No out, or inout parameter –Viod return type –No type-specific exceptions Static invocation, Server decides this synchronization scheme Dynamic invocation, client can choose oneway request (review the Request object, send operation.)
6
Advanced Comm. between Distributed Objects 6 Oneway Request CORBA IDL defines oneway operations Static invocation, Server decides this synchronization scheme Dynamic invocation, client can choose oneway request interface Team { oneway void mail_timetable (in Date date); … }; interface Team { oneway void mail_timetable (in Date date); … }; : Client : Server r:Request r =create_request() send_oneway delete() Op()
7
Advanced Comm. between Distributed Objects 7 Oneway Request Comparison Thread Less efficient (Create/delete thread) IDL (oneway) Less flexible Type safe DII Flexible using different flag with send Type unsafe Less efficient (Create/delete request object)
8
Advanced Comm. between Distributed Objects 8 Deferred Request Using thread Spawn a child thread to make synchronous request Wait for termination of the child request thread Obtain the result Performance penalty
9
Advanced Comm. between Distributed Objects 9 Deferred Request --- Using Thread class PrintSquad { public void print (Team team, Date date) { DefsyncReqPrintSquad a = new DefSyncReqPrintSquad (team, date); // do something here. a.join(this) ;// wait for request thread to die System.out.println(a.getResult()); } class DefSyncReqPrintSquad extends Thread { … DefsyncReqPrintSquad (Team t, Date d); Public String getResult(); Public void run() { strings; s = team.asString(date); // call remote method and die } class PrintSquad { public void print (Team team, Date date) { DefsyncReqPrintSquad a = new DefSyncReqPrintSquad (team, date); // do something here. a.join(this) ;// wait for request thread to die System.out.println(a.getResult()); } class DefSyncReqPrintSquad extends Thread { … DefsyncReqPrintSquad (Team t, Date d); Public String getResult(); Public void run() { strings; s = team.asString(date); // call remote method and die }
10
Advanced Comm. between Distributed Objects 10 Deferred Request CORBA Only dynamic invocation interface support deferred synchronous request Cannot be issued using client stub get_response: no-wait returns control back to client with indication if the result is ready : Client : Server r:Request r =create_request() send_defeered() delete() Op() get_response()
11
Advanced Comm. between Distributed Objects 11 Asynchronous Request Using thread Similar to deferred synchronous request Request thread invokes a call back operation Request thread join the main thread
12
Advanced Comm. between Distributed Objects 12 Asynchronous Request --- Using Thread Interface Callback { public void result (String s); } class PrintSquad implements Callback { public void print (Team team, Date date) { AsyncReqPrintSquad a = new AsyncReqPrintSquad (team, date, this); a.start(); // continue to do some work here } public void result (String s) {// callback System.out.println(s); } class AsyncReqPrintSquad extends Thread { Team team; Date date; Callback call; AsyncReqPrintSquad (Team t, Date d, Callback c); Public void run() { string s; s = team.asString(date); // call remote method call.result(s); // pass result to parent thread } Interface Callback { public void result (String s); } class PrintSquad implements Callback { public void print (Team team, Date date) { AsyncReqPrintSquad a = new AsyncReqPrintSquad (team, date, this); a.start(); // continue to do some work here } public void result (String s) {// callback System.out.println(s); } class AsyncReqPrintSquad extends Thread { Team team; Date date; Callback call; AsyncReqPrintSquad (Team t, Date d, Callback c); Public void run() { string s; s = team.asString(date); // call remote method call.result(s); // pass result to parent thread }
13
Advanced Comm. between Distributed Objects 13 Asynchronous Request CORBA : Client : Server r:Request r =create_request() send() Op() Callback ()
14
Advanced Comm. between Distributed Objects 14 Asynchronous Request Using Message Queues ClientServer Request Queue Reply Queue enter removeenter remove
15
Advanced Comm. between Distributed Objects 15 Request Multiplicity Request multiplicity Unicast (from one client to one server) Group request same operations from multiple server objects Group requests are anonymous Group composition is managed by a channel Group membership is unknown to the request producer Group members are request consumers Multiple request Different operations from different server objects that are known to the client Requested operations are independent with each other with no precedence relation Client can collect results as they become available
16
Advanced Comm. between Distributed Objects 16 Request Multiplicity Implementing group request Channel (Example 7.5) CORBA Event channel (Example 7.6) Implementing multiple request Thread Tuple space (Example 7.8) –Out –In (blocking call) –Rd (blocking call) Performance and development overhead DII (Example 7.9)
17
Advanced Comm. between Distributed Objects 17 Request Reliability Unicast Request Reliability Exactly-once Highest reliability Depends on middleware, fault-tolerant, hardware, os platforms Expensive Atomic Avoid side-effects when a failure occurs Transactions At-least-once Middleware guarantees the execution Multiple execution of a single request due to reply lose If request modify server’s state, this semantics is not desirable At-most-once If not executed, errors are raised Maybe No guarantee of execution Client doesn’t know the failure Oneway request in CORBA
18
Advanced Comm. between Distributed Objects 18 Request Reliability Group and Multiple Request Reliability K-reliability Totally ordered Best effort Trade off between performance and Reliability
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.