[omniORB] Using the _this method on activated servants
Duncan Grisby
dgrisby@uk.research.att.com
Mon, 10 Dec 2001 19:35:04 +0000
On Monday 10 December, "Brenneis, Steve" wrote:
> I am curious to know if anyone has tried using the Servant::_this method on
> a servant that has been activated in a child POA. What does omniORB return?
> Assume the child POA does not have an IMPLICIT_ACTIVATION policy and that
> the implementation has not overridden _default_POA. What happens if the
> servant is activated in multiple POA's? What does _this return in that case?
If you call _this() in the context of an operation invocation, it
should always return the object reference being used for the
invocation, regardless of the POA policies. That requires support for
PortableServer::Current, so omniORB 3 does not do that. omniORB 4
does.
Outside the context of an operation invocation (or all the time in
omniORB 3), if the servant has a single activation, the object for
that activation is returned. If it has more than one activation, or it
is not activated at all, the POA returned by _default_POA() is looked
at. If the servant hasn't overridden _default_POA(), the Root POA is
used.
If the servant is activated in the default POA, and the POA has the
single id policy, the existing activation is returned. If the servant
is not activated in the POA or the POA has the multiple id policy,
_and_ the POA has the implicit activation policy, a new activation is
made. Otherwise PortableServer::WrongPolicy is thrown.
The basic message is that _this() is a horrible mess, and you're best
to avoid it. Don't blame omniORB -- it's all specified in the
standard. :-)
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --