I need to generically intercept CORBA requests, queue them up until a connection can be made to the real server (intermittent connections) and then send the requests. The clients retrieve object references from a naming service and invoke methods statically. They expect an exception to be thrown when the connection is down (RequestPending). The objects on the ‘intermittent’ server are static implementations.

 

My initial approach comprises of an ‘interceptor’ server that publishes ‘mimic’ objects to an ‘interceptor’ naming service, and collects requests (ServerRequestInterceptor) by converting them to DII requests for persistent object references located on the ‘intermittent’ server.

 

================================

 

When the connection is made to the ‘intermittent’ server for the first time, the ‘intermittent’ naming service is examined and certain object references are pulled from it. These object references are stored in a ‘mimic’ servant derived from DynamicImplementation.

 

‘Mimic’ servants are constructed with two naming services (the ‘intermittent’ and ‘interceptor’ services) and a name:

 

1) The ‘mimic’ servant grabs the persistent ‘true’ object reference from the ‘intermittent’ service using the name.

 

2) The ‘mimic’ object then calls _repoid() on the ‘true’ object reference to retrieve the interface it’s mimicking and stores it in a local string. This local string is returned when ‘_primary_interface’ is called. This is done

to trick the client’s calls to ‘_narrow’ into succeeding (even though a mimic object doesn’t have a ‘true’ interface). Unfortunately MICO doesn’t have an ‘_unchecked_narrow’ operation, which would solve this problem and I wouldn’t have to bother with this hack (if it even works?).

 

3) The mimic object finally publishes itself on the ‘interceptor’ naming service (the one the client looks at) with the same name as the true object.

 

================================

 

Next, the ServerRequestInterceptor takes care of the ugly parts of request collection by:

 

1) Obtaining the object reference from the object ID in the request and using dynamic_cast<> to upcast the pointer to the ‘mimic’ servant.

 

2) Asks the ‘mimic’ servant for a request object (which is formed from the ‘true’ persistent object reference on the ‘intermittent’ server).

 

3) Parses the ‘ParameterList’ of the ‘ServerRequestInfo’ and turns that into a NVList for the ‘Request’ object returned by the ‘mimic’ servant.

 

4) Adds the ‘Request’ object to the queue.

 

5) Throws an ‘RequestPending’ exception so the client knows what happened.

 

Note that if a connection to the ‘intermittent’ server is live, then the above procedure is avoided and a ‘ForwardRequest’ exception is thrown with the ‘true’ object reference pointing to the ‘intermittent’ server.

 

================================

 

When a connection to the ‘intermittent’ server is finally made, we pop ‘Request’ objects off the pending queue and call ‘invoke’ for each of them, recording any exceptions thrown (there are no return values, or ‘out’ values for these DII requests – they are ignored if they existed in the initial ‘client’ request).

 

================================

 

Are there any problems with this approach? Is there a better approach? Did I miss anything?

 

Brian Lindahl

Spacecraft Software Engineer

858-375-2077

[EMAIL PROTECTED]

SpaceDev, Inc.

“We Make Space Happen”

 

_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to