Hi,<br><br>Recently I've (suddenly :-)) realized that our product never overrides _defaultPOA() method, but uses non-RootPOA for all objects (for MAN_THREAD_MODEL) and occasionally calls _this() method. After careful reading of CORBA standard I came to conclusion that _this() called for objects that are nor target of currently processed request should return reference acivated in RootPOA (thus wasting all our efforts to confine everything to our own POA). But it does not happen, it seems and after some digging I found why:<br>
<br><span lang="en-us"><font size="2" color="#0000ff" face="Courier New">void</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New">*<br></font></span><span lang="en-us"><font size="2" face="Courier New">PortableServer::ServantBase::_do_this(</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" color="#0000ff" face="Courier New">const</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"> <font size="2" color="#0000ff" face="Courier New">char</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New">* repoId)<br>
</font></span><span lang="en-us"><font size="2" face="Courier New">{<br></font></span><span lang="en-au"></span><span lang="en-au"><font size="2" color="#000080" face="Arial"> …<br></font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New"> {<br>
</font></span><span lang="en-us"><font size="2" face="Courier New"> omni_tracedmutex_lock sync(*omni::internalLock);<br></font></span><span lang="en-us"><font size="2" face="Courier New"> </font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"> <font size="2" color="#0000ff" face="Courier New">if</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New"> (_activations().size() == 1) {<br>
</font></span><span lang="en-us"><font size="2" face="Courier New"> </font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"> <font size="2" color="#008000" face="Courier New">// We only have a single activation -- return a reference to it.<br>
</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New"> omniObjTableEntry* entry = _activations()[0];<br></font></span><span lang="en-us"><font size="2" face="Courier New"> omniOrbPOA* poa = omniOrbPOA::_downcast(entry->adapter());<br>
</font></span><span lang="en-us"><font size="2" face="Courier New"> omniIORHints hints(poa ? poa->policy_list() : 0);<br></font></span><span lang="en-us"><font size="2" face="Courier New"> omniObjRef* ref = omni::createLocalObjRef(_mostDerivedRepoId(), repoId,<br>
</font></span><span lang="en-us"> <font size="2" face="Courier New">entry, hints);<br></font></span><span lang="en-us"><font size="2" face="Courier New"> OMNIORB_ASSERT(ref);<br>
</font></span><span lang="en-us"><font size="2" face="Courier New"> </font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"> <font size="2" color="#0000ff" face="Courier New">return</font></span><span lang="en-au"></span><span lang="en-au"></span><span lang="en-us"><font size="2" face="Courier New"> ref->_ptrToObjRef(repoId);<br>
</font></span><span lang="en-us"><font size="2" face="Courier New"> }<br></font></span><span lang="en-us"><font size="2" face="Courier New"> }<br></font></span><span lang="en-us"><font size="2" face="Courier New"> …<br>
</font></span><span lang="en-us"><font size="2" face="Courier New">}</font></span><br clear="all"><br>Since our servants usually activated only in one POA and usually already activated before possible _this() call -- this code 'saves' us. But there are few cases when _this() might be called on non-active object -- and it behaves as I feared (i.e. gets activated in RootPOA).<br>
<br>Now questions:<br>- I feel that this (probably helpful) behaviour is not standard-compliant -- can someone prove that it is not the case?<br>- is there any way to change RootPOA's policies? (to remove ecessity of creating another POA)<br>
- I am trying to avoid necessity of overriding _defaultPOA (someone will forget to do it and it will lead to hard-to-find problems). So there any way to ensure that all objects get activated in specific POA without this?<br>
- maybe it is possible to 'disable' RootPOA somehow?<br><br>And one unrelated question:<br>I have created a ServantManager object and registered it with POA. According to standard when object is activated _add_ref() is called nspecified number of times. The question is how many times etherealize() method of ServantManager should call _remove_ref() when called with remaining_activations = true? It works with one call -- but is it guaranteed?<br>
<br><br>Thanks!<br>-- <br>Sincerely yours,<br>Michael.<br>