[omniORB] Destroy objects
omniorb at bindone.de
Thu Apr 24 16:21:59 BST 2008
Silly & Chrischi wrote:
> I create an object with a factory-method. What have i had to call on the client, do destroy the object on the server? Every class has an destructor but I don't know what to call to start the destructor.
> Thank you.
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
You have to create an explicit destroy method on the object (also in IDL), that:
- deactivates the object in the poa
- deletes the object
(you might want to use RefCountServantBase and make destroy just decrement the reference
count and set a deleted flag on the object)
Make sure you do not shoot yourself in multi threading scenarios.
unsigned long getId();
class Xyz_impl: virtual public POA_Test::Xyz, virtual public
if (_destroyed) throw CORBA::OBJECT_NOT_EXIST();
// do sth useful
if (_destroyed) return; // might also want to throw here
// .. cleanup
_destroyed = true;
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
Please note that this example is out of context and might not work 1:1 in your setup
More information about the omniORB-list