Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Patterns - F04 Asynchronous Completion Token 1.

Similar presentations


Presentation on theme: "Software Patterns - F04 Asynchronous Completion Token 1."— Presentation transcript:

1 Software Patterns - F04 Asynchronous Completion Token 1

2 Software Patterns - F04Asynchronous Completion Token2 Context  An event-driven system in which applications invoke operations asynchronously on services and subsequently process the associated service completion event response.

3 Software Patterns - F04Asynchronous Completion Token3 Definitions  Synchronous  Blocking  Multiplex  Asynchronous  Non-blocking  Demultiplex

4 Software Patterns - F04Asynchronous Completion Token4 Problem  Initiator invokes an operation request asynchronously on one or more services, that returns its response via a completion event.  For each completion event the initiator performs the appropriate action to process the result of the operation.  There must be a demultiplexing mechanism to associate service response with the action performed by the initiator.

5 Software Patterns - F04Asynchronous Completion Token5 Synopsis  The Asynchronous Completion Token design pattern allows an application to demultiplex and process efficiently the response of asynchronous operations it invoke on services.  Also known as: Active Demultiplexing, Magic Cookie

6 Software Patterns - F04Asynchronous Completion Token6 Example Electronic Medical Imaging System  Single Host  Multiple Hosts

7 Software Patterns - F04Asynchronous Completion Token7 Common Traps and Pitfalls  Spawn new thread for each request Increased complexityIncreased complexity Poor performancePoor performance Lack of portabilityLack of portability  Service provide sufficient info in event Excessive bandwidthExcessive bandwidth Lack of contextLack of context Performance degradationPerformance degradation

8 Software Patterns - F04Asynchronous Completion Token8 Forces  Initiator and not the service should be responsible for determining how the completion events are demultiplexed.  Minimizing communication overhead is important.  Spend as little time as possible demultiplexing the completion event to the handler.

9 Software Patterns - F04Asynchronous Completion Token9 Solution  With every asynchronous operation that a client invokes on a service, transmit information that identifies how the initiator should process the services response.  The service returns the information to the client, allowing it to efficiently demultiplex and process the response.

10 Software Patterns - F04Asynchronous Completion Token10 Structure  Service Provide asynchronous functionalityProvide asynchronous functionality  Initiator Invokes operations on services asynchronouslyInvokes operations on services asynchronously Defines completion handlersDefines completion handlers  Completion Handler Defines an interface for processing the results  Asynchronous Completion Token (ACT) Identifies the completion handler

11 Software Patterns - F04Asynchronous Completion Token11 Dynamics

12 Software Patterns - F04Asynchronous Completion Token12 Implementation Details Interesting…  Define ACT representation Pointer ACTsPointer ACTs Object reference ACTsObject reference ACTs Index ACTsIndex ACTs  Holding ACTs at the initiator ImplicitImplicit ExplicitExplicit

13 Software Patterns - F04Asynchronous Completion Token13 Implementation Details Not so interesting…  How to pass the ACTs ?  Holding ACTs at the service ?  Strategy for demultiplexing ACTs ?  How often can an ACT be used ?  What if we have a chain of services?

14 Software Patterns - F04Asynchronous Completion Token14 Benefits  Simplified initiator data structures  Time efficient demultiplexing  Space efficient demultiplexing  Flexible (use what you want as an ACT)  Initiators can be single-threaded or multi- threaded

15 Software Patterns - F04Asynchronous Completion Token15 Liabilities  Memory leaks  Authentication of ACTs  Application re-mapping

16 Software Patterns - F04Asynchronous Completion Token16 Known Uses  HTTP-Cookie Server as initiator, browser as serviceServer as initiator, browser as service  OS asynchronous I/O Windows NTWindows NT POSIXPOSIX  CORBA demultiplexing  JINI  FedEx inventory tracking Write a note for yourself on your notification when the transaction has completedWrite a note for yourself on your notification when the transaction has completed

17 Software Patterns - F04Asynchronous Completion Token17 Questions ?


Download ppt "Software Patterns - F04 Asynchronous Completion Token 1."

Similar presentations


Ads by Google