Per Bockman wrote:
> 
> ...
> 
> Luke,
> 
> > I'm using the standard jdk orb. I also get a security exception when
> > trying to use the Singleton orb instance - this is a bit
> > strange as the
> > documentation implies the access to this should only be
> > restricted when
> > using an applet. This is a bit of a drag, as calling
> > org.omg.CORBA.ORB.init(args, props) will create a new orb
> > instance each
> > time which isn't very efficient if done for every call.
> 
> The Singleton ORB could be used in applications or applets. The Singleton ORB is 
>really a crippled ORB with only limited functionality (e.g. creating typecodes).
> 


Ah. While reading the JDK docs, I misread the line "in the event that
it is called in an applet environment, the ORB it returns is restricted
..." as meaning that it is only restricted in an applet environment. It
should probably be changed to indicate that the default implementation
is *always* restricted. As you say below, you end up wrapping your own
orb instance in a singleton object to get round the problem of creating
multiple orbs. I suppose you could set the
org.omg.CORBA.ORBSingletonClass properity to be the same as
org.omg.CORBA.ORBClass and that would have the same effect.

> Calling ORB.init(...) multiple times (at least with different configuration 
>arguments, e.g. different ORBNames) should return different ORB instances. 

I don't think it matters what the arguments are - init(args, props)
will always return a new instance. What are ORBNames? I wasn't aware
you could name orbs. POAs have names but I don't think orbs do.

> This is not only inefficient; it would also yield a faulty behavior at least if your 
>doing this on the serverside. A better approach would be to create a class that wraps 
>your "fully functional ORB" instance as a singleton.
>
 
It is obviously unnecessary in the case of a client, as we have here,
and I haven't ever seen a practical case when you would want to create
multiple orbs on the server (though I've come across people doing so,
and complaining that the orb was leaking memory :-). But I don't see
why it would necessarily cause faulty behaviour, apart from due to a
bad implementation. Why can't multiple orbs happily co-exist in the
same process?

Luke.


-- 
 Luke Taylor.
 PGP Key ID: 0x57E9523C

Reply via email to