Child object interaction

Figure 8 illustrates the calling sequence for a request that requires a new child dispatcher.


Using a shared transport, a parent caller makes a request to a parent dispatcher specifying the type of request it is making. The parent dispatcher processes the request by unmarshalling the parameters from the argument stream and sending the arguments to its implementation instance.

The implementation performs a Lookup operation on the child directory, searching for an entry that matches the request type specified by the caller's arguments. If the Lookup operation fails to find a match, the implementation creates a child dispatcher and child implementation to handle the request.

Here, the parent dispatcher determines the type of child dispatcher to create based on the request made by the parent caller. Once the new child dispatcher is instantiated, the implementation performs an Add operation on the child directory to add the child dispatcher and to get a child ID. It then returns the child ID to the parent dispatcher, which in turn sends the child ID back to the parent caller.

The parent caller receives the reply from the parent dispatcher and begins to unmarshall it. Once it sees the child ID in the message header, it calls a member function that creates a child caller, passing the ID and the shared transport instance to the child.

The caller child re-issues the request to the parent dispatcher, specifying the child ID. The parent dispatcher unmarshalls the request, recognizes the child ID, and calls its implementation instance. The implementation performs a Lookup operation on the child directory, using the child ID, which returns the name of the child dispatcher to call. The implementation then forwards the caller's request to the child dispatcher.

From here, the child dispatcher processes the request, calling its implementation object to execute the remote function. When done, the child dispatcher marshalls the reply into the result stream and sends it back to the child caller (via the parent dispatcher). The result propagates back to the instance that initiated the call.

NOTE How you actually instantiate your caller child is up to you. This process shows one way of instantiating a caller child that is linked to specific child dispatcher.

Using the child directory

Figure 1 illustrates how a parent dispatcher processes a request for a child dispatcher that is not yet instantiated. In cases where the Lookup operation finds a match, indicating that the child dispatcher already exists, the parent dispatcher immediately returns the appropriate child ID to the parent caller. The parent caller can then instantiate a child caller with the child ID and the shared transport, and the child caller continues the communication from this point.

If Lookup returns an exception, the parent dispatcher returns this to the caller in the reply.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker