[omniORB] Re: Is a servant allowed as member variable of another servant?

Steinar Bang sb at dod.no
Fri Jan 23 13:15:34 GMT 2004


>>>>> Carlos <carlos at canama.net>:

> If you activate the object A in a POA then you can use references to
> A,

For this, it is enough to call _this() on the A servant, isn't it?

> but if you want to use the NS for obtaining references to this
> servant you must bind it in the NS.

For the servant instance present in-process with the B servant, this
isn't neccessary (though, there will a different instance of the A
servant, running in a separate process registered with the NS).

> You must register (bind) the object in the NS.

Normally the servant for B would be registered in the main() of the
program the servant resides in.  The main function consists of
 - CORBA ORB init
 - Creating a servant object
 - Getting an interface reference, using _this()
 - Registering the interface with the naming service
 - Activate the POA manager
 - Call run() on the ORB

I guess the only reason B wouldn't show up in the NS, would be that
the B servant constructor never returned...?  The B servant
constructor constructs an A servant, and then calls _this() on the A
servant, to get a POA managed object reference.

Perhaps the timing of the calling of _this(), on the A servant is the
problem?

This call to _this() is done before the B servant constructor has
completed, and before _this() has been called on the B servant.

>> Is a servant for one interface, allowed to exist as a member
>> variable of a servant for another interface?

> Yes, I do it and it works fine.

Thanx for the info.


- Steinar



More information about the omniORB-list mailing list