[omniORB] POA-question
Duncan Grisby
dgrisby@uk.research.att.com
Wed, 11 Jul 2001 11:50:01 +0100
On Tuesday 10 July, Empting Arnd wrote:
> In special the end of Servants and Objects is not
> clear to me. Unfortunatly most examples just call
> orb->destroy() and dont show explicit the destruction
> of an object.
[...]
> how do i get rid of the echo-server and start a new one in the same process.
> My guess is i have to call:
>
> poa->deactivate_object(myecho); // to get rid of the servant
deactivate_object() takes an object id as its argument. You should use
poa->deactivate_object(myechoid);
> // can i activate it again now with poa->activate_object(myecho) ?
Sort of. The code you quoted called _remove_ref() on the servant, so
the only reference to it was held by the POA. This means that when you
called deactivate_object(), the servant object was deleted.
If you want to activate a different servant, you can create another
one with new, and then activate it. Alternatively, if you don't call
remove_ref(), the servant won't be deleted when it is deactivated, and
you can reactivate it. Note that if you call activate_object() again,
it will result in a different CORBA object, since the POA will invent
a new object id. If you want to keep the same id as the old object,
use activate_object_with_id(), passing in the id you got with the
first activation.
> CORBA::release(myecho); // to release the CORBA-Object
Yes. Remember that this does not affect the servant object in any way.
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --