[omniORB] Servant Forking

Alex Tingle alex.omniorb at firetree.net
Sat Jul 30 02:46:45 BST 2005


On Fri, 29 Jul 2005 12:32:58 -0500
Wade Hunkapiller <incrediblehunk at gmail.com> wrote:

> I've developed a servant that provides an interface to a legacy
> FORTRAN simulation library to provide the capability of having
> multiple "instantiations" of the FORTRAN model.
> 
> I would like to be able to have some sort of daemon process similar to
> a Servant Activator that simply forks off a new process that runs a
> reference of my servant to be used by another client.

The TCP port is an integral part of a CORBA object's unique id, so you cannot move an existing CORBA object to a different process. You CAN redirect (LOCATION_FORWARD) calls to a NEW object. Look at the omniMapper utility to see how it's done.

You could just fork a new non-CORBA process to do the work, and communicate through a pipe, using popen().

Pay careful attention to the nasty interactions between fork() and pthreads. Unless you use omniORB's MAIN_THREAD_MODEL, then servant codes is always run within a thread, and that's bad news for fork()ing. The golden rule is "only ever fork() from the main thread". The same applies for popen() of course.

-Alex

-- 
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net  +44-7901-552763 



More information about the omniORB-list mailing list