120 likes | 270 Views
Objektorienteret Middleware (TIOOMI). Presentation 14: Callbacks. Outline. Motivation Using TTS as example CORBA Callbacks Issues & solutions Alternative solutions. Data Collection & Presentation. TRS. Server. New Reading. CORBA Object. PSP. View Readings. DB.
E N D
Objektorienteret Middleware (TIOOMI) Presentation 14: Callbacks
Outline • Motivation • Using TTS as example • CORBA Callbacks • Issues & solutions • Alternative solutions
Data Collection & Presentation TRS Server New Reading CORBA Object PSP View Readings DB Classic CORBA Client / Sever model is sufficient for Data Collection & Presentation
Alarm level surveillance TRS Server (TRS) New Reading CORBA Object PSP View Readings Present Alarm DB Problem: The client / server pattern breaks down when we want to notify FROM the server to the client. Solution: Client polling OR peer-to-peer model -> e.g. using Callbacks
CORBA Callbacks • CORBA specification: • ORB is BOTH client AND server channel • Peer-to-peer architecture • All client programs may register server objects - e.g. Callback object • How-to: • TTS: RegisterCallback(ObjRef) -> list of PSP’s • PSP: Notify() • Callback object should be transient only
Issues • Distributed Deadlock • If client and server single-threaded • Client calls server, server calls client at same time • Deadlock – both are blocked, waiting for a response • OB: recommends thread-per-request semantics • Solutions: • Do not make single-threaded applications • Problem: not all OS’s support multithreading • Inconvenience : multithreading introduces new complexities • OR use “oneway” semantics • Problem with oneway: • “Maybe” semantics, no return value, no exceptions • Some ORB’s ignores “oneway” and performs a regular synchronized call – but this can be tested • Check ORB vendor manual for recommendations!
Other issues (Henning & Vinoski) • Callback Persistence • Server should store registered callbacks on persistent storage in case of server failure • Callback Failure • As callback objects are transient, server should employ a “timeout” strategy for callback communication • Coupling • Callback objects comes at a price of higher coupling
Alternative solutions • Event Service • Suppliers produces events, consumers receives them through an event channel • Push or Pull model • Decouples using Mediator pattern & asynchronous communication, and exchanging “Any values” • Read more in OOMI-3: chapter 12 • Notifcation Service • Extends the Event Service • Allows the use of well-defined data structures • http://www.borland.com/resources/en/pdf/white_papers/borland_notification_service_visinotify.pdf
Good support for the Event Service & Notifcation Service Source: http://www.puder.org/corba/matrix/
Group Assignment 1 • Use the rest of todays lesson for group work • Each Group Should: • Make a pseudo code implementation of a multi-client GPS location system, where each client logs its current location with a “configurable interval”, records it with a single CORBA servant, including its own ID and the “current interval setting” and the local time of the device, while at the same time keeping up to date with the other clients current GPS position utilizing callbacks • Consider which patterns might be helpful? • Consider what might happen if you implement an xml file on the server for storage. What might go wrong? • Discuss how your system might deadlock – and discuss what you could do about it • REMEMBER: theres a page 2 here? (see next slide)
Group Assignment 2 • Now consider how we might optimize performance, in the case of some clients being located within the same WiFi LAN area, but the server is only available via WAN. Consider also that different groups of clients might be within different WiFi LANs. • At home: • try to implement a sample CORBA system (e.g. the above) that will deadlock at some point in time (and explain why) • Implement a fix to the above CORBA system that will solve the deadlock – and explain why
CORBA er velegnet Til at lave Callbacks Og dermed Observer pattern. Det er ikke alle Middlewares der er det. Læringsmål Alignment Når kurset er færdigt forventes den studerende at kunne: • Definere, beskrive og sammenligne forskellige typer af objektorienterede middleware frameworks til apparater og computere, med primær fokus på CORBA og sekundært .NET Remoting teknologierne, herunder fordele og ulemper forbundet med de forskellige teknologier • Definere og beskrive principper omkring transparens og heterogenitet i relation til middlewareteknologier • Definere og beskrive gængse teorier, metoder og retningslinier indenfor det objektorienterede middleware paradigme og anvende disse til at designe effektive distribuerede systemer • Designe og konstruere et distribueret system der gør brug af CORBA og .NET Remoting teknologierne med tilhørende værktøjssupport CORBA er mere access trans end mange andre fsva Callbacks Væsentligt at forstå Callback / Observer Mekasismen som design Instrument. MANGLER: hvordan I praktisk omsætter denne viden. Fås ved projekt.