Re: Default ORB or "bug"?

Dion Picco <[email protected]> Wed, 18 May 2005 13:05:01 -0230
Newsgroups gmane.comp.corba.orbacus
Organization IONA | Making Software Work Together TM
Message-ID <[email protected]>
Hi Stefan,

On Fri, Apr 01, 2005 at 10:33:22AM +0200, Stefan Blum wrote:
> Hi,
> 
> accidently I permuted the normal order of 
> 
> a) creating ORB and POA etc.
> 
> and 
> 
> b) invoking _this() on a servant.
> 
> within a server. I was woundering why the application was still running,
> but was not able to be configured by command like options. I assume that
> something like a default ORB (and RootPOA) must have been implicitly
> created without ORB_init(argc,argv,...).
> 
> Is this conform to the specification? This behavior seems to me
> error-prone. Suppose one wanted to change the OA to reactive by
> "-OAreactive" which definitely does not work.
> 
> I have appended a patched version of the hello demo. (worked for me:
> Linux2.4, gcc-2.95.3, OB-4.2.0). To test:
> 
> invoke the server (./server -OAreactive)
> invoke the client and type 'h' once
> count number of thread of the server (e.g. ps auxwww | grep server)
> (normally supposed to be one (cf. normal hello demo))
> 
> My suggestion: If the normal order of a) and b) is permuted, _this()
> should give at least a warning.
> 
> Best regards,
>   Stefan
> 

If you do not override the _default_POA() function of a servant then it
has no choice but to use the RootPOA on the default ORB (the unnamed
ORB).  In order to obtain a pointer to this ORB, the default function
_default_POA() will call ORB_init(.., .., "") to get a handle to it.  If
it isn't created, this will of course create that ORB.  
We have considered putting a warning there if _default_POA() isn't
overridden.  In fact there are other potential problems as well if you
don't override _default_POA().  You can do things like
orb->object_to_string() on a different ORB than what contains the POA
your servant is located on.  However since it isn't mandated by the spec
that the user override _default_POA(), we haven't implemented anything
at this point.  My best advice is to ALWAYS override _default_POA() for
all your servants except in the most simple of demonstration cases where
you know you'll use an unnamed ORB and RootPOA.

Cheers.

-- 
Dion Picco, Software Engineer
IONA Technologies Inc.
Team Orbacus - Your CORBA Source
mailto:[email protected]
http://www.orbacus.com
_______________________________________________
OB-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/ob-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html