[omniORB] Help Orbix and OmniOrb Spawning

Duncan Grisby dgrisby@uk.research.att.com
Mon, 11 Feb 2002 18:11:42 +0000


On Thursday 7 February, Andrew Mak wrote:

> I am writing regarding the below mail Sai-Lai Lo wrote back in July 1997. I
> was wondering  if anyone could you tell me more information regarding
> creating a daemon (like Orbix) in OmniOrb. Basically what we require is to
> spawn the server on demand, just like orbix. Currently we are using orbix
> 2.3c and wish to port to OmniOrb.

If you look in src/appl/omniMapper, you'll find a program that does a
lot of the work that would be required by an implementation repository
daemon like the one in Orbix. It redirects client requests to another
server. What it doesn't do is start the server processes. What you
need to do to make it work like the Orbix daemon is to create a new
process when the request comes in, then redirect to it.

The slight difficulty is that a lot of platforms get upset if you fork
from a multithreaded program. The safest thing to do is to structure
your daemon so the first thing it does, before it calls ORB_init(), is
to create a pipe and then fork. The parent activates the ORB and
starts listening for requests. The child stays single-threaded and
listens on the pipe. When a server needs to be started, the parent
sends a suitable command down the pipe, and the child forks and execs
the server. You'll have to come up with some scheme for communicating
the new server's IOR back to the main daemon process, either by
sending it back through another pipe, or doing a CORBA call from the
server to the daemon.

You might find that it's far easier to do all this sort of stuff in
Python, especially if you need your daemon to be cross-platform.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --