[omniORB] how to load corba module in run time

JHJE (Jan Holst Jensen) jhje at novonordisk.com
Sat Jun 26 17:04:29 BST 2004


> these days i have a quiz, i have a control module in the 
> service layer, it 
> receive request from application layer, and judge which 
> module to be load dynamiclly. the
> module that to be loaded is a corba module either.

OK, so you have a CORBA service layer that is supposed to start
different CORBA servants depending on the request from the application
layer ? If so, that is generally known as a factory.

> but how can i do that? i create a new thread, in that thread, 
> i get a new orb object, and 
> register the service to that orb, then run the orb, all the 
> code looks like in the example
> running in single thread. fortunately, it works. but another 

Sounds to me like you are creating CORBA servants that run in dedicated
threads with their own orb instance perthread. Not a good idea. OmniORB
is already multithreaded, so no need for that.

> problem comes: i don't know how
> to unload that module normally. either i kill the thread 
> directlly, or delete the corba's 
> object will result to a corba exception. and any code in my 
> corba object's destructor will 
> not be executed.

Normally a factory method will simply create a new CORBA object (and
usually an underlying servant as well, unless you use e.g. a default
servant policy), and return that object reference to the client. To
"unload the module", that is: destroy the servant, the servant's
interface must either have a method that explicitly destroys it or it
must time out and self-destruct like e.g. iterators returned from the
naming service.

See e.g.
http://www.omniorb-support.com/pipermail/omniorb-list/2003-September/024
248.html where there was a similar discussion about object lifecycle
management.

Hope that I am pointing you in the right direction here.

Cheers

-- Jan Holst Jensen, Novo Nordisk A/S



More information about the omniORB-list mailing list