[omniORB] Destructor and Factories
Martin Renner
Martin.Renner@pp-ulm.de
Thu, 10 Dec 1998 13:23:46 +0100
Hi.
I have a CORBA-Object that creates another object for my clients (it's a
factory). The implementation of the factory looks like that:
Test_ptr TestFactory_i::createTest()
{
Test_i * corbaTest =3D new Test_i();
corbaTest->_obj_is_ready(_boa);
Test_i::_duplicate(corbaTest);
// refCount=3D2
return corbaTest;
}
The client invokes this methode in the following manner:
{
Test_var t1 =3D factory->createTest();
}
Now, I have one problem: On the server-side, the destructor of "Test_i" is
never called. After returning the reference to the client, the reference
count of "Test_i" is decremented to 1 (okay). But how can I delete this
object, when it is not any longer used by the client?
In my opinion, the object on the server-side should be deleted after the
last client-proxy is deleted (that is, when the client called
CORBA::release()). The client-proxy should decrement the reference count on
the server side to 0. Otherwise, there's no way for the server to detect,
when a reference, that was passed to a client, is not any longer used.
__ =20
_________ / /\_________________________________________________
/ / \ Martin Renner
/_/ /\ \ PP-Systemhaus GmbH=20
__\ \ \/ / the client server company=20
/ /\\ \ /=20
/ / \\ \ \ Address : Magirusstra=DFe 4, 89129 Langenau
/_/ /\ \\ \ \ Phone : +49 7345 9669-0
\ \ \/ / \_\/ Fax : +49 7345 9669-20
\ \ / mailto:Martin.Renner@pp-ulm.de
\ \ \ http://www.pp-ulm.de
______\ \ \____________________________________________________
\_\/