[omniORB] strange behavior of '_this()' method
Michael Kilburn
crusader.mike at gmail.com
Fri Mar 20 20:32:48 GMT 2009
Hi,
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:
void*
PortableServer::ServantBase::_do_this(const char* repoId)
{
…
{
omni_tracedmutex_lock sync(*omni::internalLock);
if (_activations().size() == 1) {
// We only have a single activation -- return a reference to it.
omniObjTableEntry* entry = _activations()[0];
omniOrbPOA* poa = omniOrbPOA::_downcast(entry->adapter());
omniIORHints hints(poa ? poa->policy_list() : 0);
omniObjRef* ref = omni::createLocalObjRef(_mostDerivedRepoId(),
repoId,
entry, hints);
OMNIORB_ASSERT(ref);
return ref->_ptrToObjRef(repoId);
}
}
…
}
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).
Now questions:
- I feel that this (probably helpful) behaviour is not standard-compliant --
can someone prove that it is not the case?
- is there any way to change RootPOA's policies? (to remove ecessity of
creating another POA)
- 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?
- maybe it is possible to 'disable' RootPOA somehow?
And one unrelated question:
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?
Thanks!
--
Sincerely yours,
Michael.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20090320/31740acc/attachment.htm
More information about the omniORB-list
mailing list