[tao-users] TAO Callback Timeout

Winkler Martin M.Winkler at hainzl.at
Tue Apr 28 06:21:03 CDT 2015


Hello Phil,

thank you. Now the callback timeout is working.

> Great. I’m glad to see someone else embracing Asynchronous messaging! I used it to improve the performance of the Implementation Repository while keeping it single threaded. 

>> What is not clear to me is, how to set the timeout on the callback object which gets registered on the server. How do I set the timeout on the callback?  Has this to be done on the client or the server? (I’d like to get a timeout, when the server calls back to the client and the request takes too long).
>>  
>> When I set a global RELATIVE_RT_TIMEOUT_POLICY on the server orb, the timeouts are working. But I’d like to use timeouts on individual objects.
>>  
>> Any suggestions?
>>  

>Sure. The server becomes a client of the callback object. You apply a RRTT policy to the callback reference by using set_policy_overrides () on the callback reference. Remember to take the returned object reference and narrow it >back to the callback reference type.

>For example see ImR_Locator_i::server_is_running() in $TAO_ROOT/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp and for handling the timeout see PingReceiver::ping_excep () in $TAO_ROOT/orbsvcs/ImplRepo_Service/LiveCheck.cpp

I had tried this before. I have set the RRTT policy and used the returned object reference. The problem was, that I did not duplicate the original object reference of the callback. I assume the client released that object. Thus the callback did not work. Now I duplicate the registered callback reference, store it on the server and get an object with timeout from that stored reference. Now everything works.

> Feel free to follow up if you have more questions.

Now that the callback is working, I have to more questions:

1. I use one AMI Callback Object for all calls. Is this ok, or is it better to use a new object for 
each call? 
It can happen, that answers from the last calls are not here and the method is called again with the same
AMI callback object. For example (pseudocode):

AMI_CallbackObject_var cb1;
obj->sendc_methodx(cb1.in()); 
obj->sendc_methodx(cb1.in()); //answer from first call is not here

It seems to work but i am not sure if this can lead to problems.


2. I was wondering if there a generic way to handle errors on the client object and the server callbacks. 

When a call from the client fails (an exceptions is thrown), i set the client object in a disconnected state,
and try to reconnect the object in an extra thread to the server.

When a call on the callback fails I assume the client has crashed and remove the callback from the server. When the client
starts again he registers the callback and everything is working again. 

This seems to be a pretty common use case to mee. 
So is there a generic way to handle the reconnects after a failed call to the server or client?


Best regards,
Martin





More information about the tao-users mailing list