[omniORB] How can I wait for object deactivation with deactivate_object() ?

Martin B. 0xCDCDCDCD at gmx.at
Thu Jan 6 17:21:36 GMT 2011


On 06.01.2011 13:07, Duncan Grisby wrote:
> On Mon, 2011-01-03 at 17:41 +0100, Martin B. wrote:
>
>> I'm using the omniINSPOA to activate one CORBA object, but at the point
>> where I want to "destroy" the object I want only to deactivate this
>> object but keep the omniINSPOA running.
>>
>> For objects in "normal" POA, I have always simply used
>>     ...
>>     PortableServer::POAManager_var pman ...
>>     pman->deactivate(true, true);
>>     ...
>> to simply wait for all objects and destroy them (implicitly via
>> ServantBase::_remove_ref())
>>
>> Now, if I do not want to destroy the POA (manager), I can only call
>> deactivate_object(..) for my omniINS object, but this does not allow for
>> waiting until all requests have terminated.
>
> Do you really need to wait for deactivation?  If you're just waiting so
> you can call _remove_ref at the right time, you can just call
> _remove_ref at any point earlier, and then when the object is
> deactivated the POA will call _remove_ref and trigger deletion of the
> servant.
>

Yes, I'm already relying on the POA to finally delete my servant object. 
It was just that at the moment where I called deactivate_object, I 
wanted to wait for all calls to complete to avoid any timing related 
problems.

> If you really want to know, the way to do it is to provide your own
> _remove_ref implementation so you know when the POA calls it.
>

Thanks for the tip about _remove_ref() ... what I did in the end was to 
add some code to the servants d'tor so that I could mark the object as 
finally deactivated from there.

cheers,
Martin



More information about the omniORB-list mailing list