[omniORB] POA-question

Empting Arnd Arnd.Empting@kst.siemens.de
Tue, 10 Jul 2001 09:48:17 +0200


Hi,

i have still some questions regarding POA.

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. 

If i take the simple example from the omniorb-doc:

int
main(int argc, char **argv)
{
CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv,"omniORB3");

CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
Echo_i *myecho = new Echo_i();
PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);

Echo_var myechoref = myecho->_this();
myecho->_remove_ref();

PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();

hello(myechoref);

orb->destroy();
return 0;
}

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

// can i activate it again now with poa->activate_object(myecho) ?

CORBA::release(myecho);          // to release the CORBA-Object

could someone please tell me if i am right or wrong with this behaviour???

thanks a lot

Arnd