[omniORB] deleting active servants

Duncan Grisby duncan at grisby.org
Fri Dec 5 17:24:35 GMT 2003


On Wednesday 3 December, Carlos wrote:

> Pánczél Levente wrote:

> > Thanks Duncan! Though I really read that in the documentation, I
> > forgot about it. So if I understand right, I have to do the
> > following:
> > The POA's reference is held by the object. When I need the object
> > to be deleted, I simply call POA::deactivate_object() and that
> > releases both the POA and the servant?
> 
> No, deactivate_object only calls the destructor of the servant.

No it doesn't!  deactivate_object calls _remove_ref on the servant.
If the implementation of _remove_ref so decides, _that_ deletes the
servant.

Most importantly, deactivate_object does not always call _remove_ref
immediately; in many cases, that happens some time after
deactivate_object returns.

It sounds to me like you can get the behaviour you want by
implementing your own reference counting functions, rather than using
RefCountServantBase. That will allow you to know exactly when your
servant is deleted (since it will be your code that does the
deletion), and thus do whatever else is required at that time.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list