Previous Table of Contents Next


22.8 Type-Specific ReplyHandler Mapping

   For each interface, a type-specific reply handler is generated by the IDL compiler. The client application implements and registers a reply handler with each asynchronous request and receives a callback when the reply is returned for that request. The interface name of the type-specific handler is AMI_<ifaceName>Handler, where ifaceName is the original unqualified interface name. If the interface ifaceName derives from some other IDL interface baseName, then the handler for ifaceName is derived from AMI_<baseName>, but if it does not, then it is derived from the generic Messaging::ReplyHandler. If the interface name AMI_<ifaceName>Handler conflicts with an existing identifier, uniqueness is obtained by inserting additional “AMI_? prefixes before the ifaceName until the generated identifier is unique.

   When invoking an async operation, the client first generates an object reference for its ReplyHandler and then associates it with the request by passing the reference as an argument to the operation. The reply will be targeted to that ReplyHandler. So that a single ReplyHandler servant instance can be supplied to multiple requests, the client can assign unique ObjectIds for each request if the application code needs to distinguish between each of these requests at a later time. Most commonly, the application needs to access information from the calling scope while in the scope of the callback. That information can be associated with the ReplyHandler’s ObjectId by the client application at the time of invocation. Obtaining the ReplyHandler’s ObjectId within the callback implementation allows that implementation to obtain any information previously associated with the original request. Since the assignment and accessing of these ObjectIds is fully supported within the Portable Object Adapter defined in CORBA, there is no need to specify the notion of unique request ids in this document.

   The ReplyHandler object reference will be serviced by a servant running under a POA with a particular set of POA policies. These policies are not affected by the fact that it is a ReplyHandler, so these Policy values have the same considerations as with any server. The POA LifeSpanPolicy will probably be affected depending on whether or not TII is used: