[omniORB] Dynamic destruction of servants when no client references

Steven King steve at eminence.com.au
Tue Apr 12 19:10:01 BST 2005


<div class="moz-text-flowed" style="font-family: -moz-fixed">Hello,

I know that we have posted twice today, sorry guys, but I hope this is
challenging and I know you like a challenge. :)

We are implementing a Corba DOM interface using DOM level 1 IDL. A
Document has some factory methods such as "DOMElement createElement (in
string name)"  On the corba  side we implement this by doing:
     dom::Element_ptr Document_i::createElement(const char * name) {
         XMLCh* str = xercesc::XMLString::transcode(name);
       Element_i* element_i = new Element_i(doc->createElement(str));
       xercesc::XMLString::release (&str);
       return element_i->_this();
}

Where an Element interface is defined in IDL and has an implementation
called Element_i.

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.

How would we go about mapping the CORBA::release(CORBA::Object_ptr ) to
the equivalent servant and call _remove_ref() on that servant for
elegant clean up of the servants resources? Is there a way to go about
this type of behaviour? (I have looked at using another POA with
different policies but CORBA does not seem to cover this case.)
We DO not want to implement another IDL interface for freeing resources
(such as a Element::destroy()) since this leads to other problems and is
non conformant to DOM.

Look forward to your responses,

Steven King

-- 


<http://www.eminence.com.au/> Eminence Technology Pty Ltd
PO Box 118, Moorooka QLD 4105
Web: www.eminence.com.au <http://www.eminence.com.au/>
Ph: +61-7-3277-4100
Fax: +61-7-3277-4577





More information about the omniORB-list mailing list