[omniORB] Dynamic destruction of servants when no client references

Duncan Grisby duncan at grisby.org
Tue Apr 12 12:31:20 BST 2005


On Tuesday 12 April, Steven King wrote:

[...]
> The problem is, after we create the servant and activate it on the
> rootPOA, the servant stays allocated and available on the Active Object
> Map even after a client has finished using the Element_ptr returned.  I
> understand that because of the loose coupling between the client and
> servant, the CORBA::release() called on the client never works on the
> Servant (_remove_ref()).  However in this case, this operation is
> desired and seems logical.

The CORBA object model is that objects do not know who their clients
are, so there is simply no way to automatically deactivate an object
when its last client goes away. It has to be implemented at the
application level. There is no one right answer, but there are a number
of common patterns. The best reference is Henning and Vinoski's Advanced
CORBA Programming with C++.

The easiest thing to implement is often a timeout so that objects that
have not been touched for a while are deactivated.

Cheers,

Duncan.

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



More information about the omniORB-list mailing list