[omniORB] Beginner's question about corbaloc
fischer.c at atlas.de
fischer.c at atlas.de
Mon Nov 15 11:17:07 GMT 2004
Hi Duncan,
thanks for clarifying this point. In chapter 11.6 'Servant IDL Type',
Henning & Vinoski write that _default_POA() can be overriden to enable
_this() to activate objects in a POA other than the root POA.
But this seems only necessary if the object is not already activated.
Where can i find further information on this topic? The POA chapter in
the OMG CORBA specification doesn't say really much.
Are you sure that what you say applies to other ORBs, too? I feel like
having had this double activation problem with a quite old version of
VisiBroker.
Best Regards
Clemens
-----Ursprüngliche Nachricht-----
Von: Duncan Grisby [mailto:duncan at grisby.org]
Gesendet: Freitag, 12. November 2004 20:00
An: Fischer, Clemens
Cc: J.Koenig at adg.de; omniORB-list at omniorb-support.com
Betreff: Re: AW: [omniORB] Beginner's question about corbaloc
On Friday 12 November, fischer.c at atlas.de wrote:
> After activating the servant by activate_object_with_id() you are calling
> _this() to create an object reference.
> This call is obsolete and may also lead to some strange side effects.
_this() is not obsolete. It can have some strange effects if you
don't understand it, though...
> You should simply remove it, because the object references that it
> returns is not used at all and is not the one you expect.
It's true that in this case the return value is not used, so it can be
removed.
> To go into more detail, _this() activates your servant in the POA
> returned by the virtual ServantBase method _default_POA(). As long
> as you don't override this method, it will return the root POA. As a
> consequence calling _this() in the way you do ends up with your
> servant activated twice, once in omniINSPOA and once in the root
> POA.
That's not true. If the servant has just one activation, which in this
case it does, _this() returns the existing object reference (in the
omniINSPOA), rather than doing a new activation.
To be paranoid, it's often a good idea to define _default_POA() to
return the correct POA, but it is not always necessary to do so.
> Moreover the object reference returned by _this() is not identical
> to the one used by your client, because it actually created a
> different object.
Not true.
> If you need the object reference of the correct object somewhere in
> your server's code, i.e. for registration in a naming service, you
> should create it by the following call:
>
> CORBA::Object_var obj = poa->id_to_reference(oid);
The problem with that is that you then have to narrow it to the right
type, whereas _this() already returns the correct most derived type.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list