[omniORB] Re: One more multi-thread question
Jonathan Biggar
jon at levanta.com
Thu Jan 10 09:03:44 GMT 2008
Duncan Grisby wrote:
>> Futhre, if we incarnate one more servant whose implementation is the
>> same as the previous one, does that still mean all threads/tasks enters
>> the same memory area as previous one? Because functions of different
>> objects of the same class just shares the same memory area, and the only
>> difference is the implicit 'this' pointer passed as the parameter.
>
> If you incarnate another servant, it will correspond to a different
> CORBA object. If all the client calls are to the first CORBA object, all
> the calls will be handled by the first servant, and the second servant
> will be ignored.
>
>> So can we conclude that incarnating more than one servants of the same
>> implementation class does not help improve the multi-thread efficiency?
>
> No. I think you are imagining some kind of link between servants and
> threads. There isn't any relationship between them. CORBA objects can
> map to servants in various ways, depending on the POA setup, but
> threading never comes into it.
Actually, if you find a need to code a CORBA server where each incoming
CORBA request thread for a given object needs its own servant, you can
install a ServantLocator in your POA to accomplish this. Each call to
ServantLocator::preinvoke creates a new servant, and each call to
ServantLocator::postinvoke destroys it.
This can be useful when all of your object state is stored externally,
like in a database, and you don't want to cache any state in the servant
class itself.
--
Jon Biggar
Levanta Inc
jon at levanta.com
More information about the omniORB-list
mailing list