[omniORB] issues with multiple orbs in a server gui app

Jason Dolan jason at pcc.com
Wed Jan 18 12:16:55 GMT 2006



Duncan Grisby wrote:
> On Wednesday 18 January, Jason Dolan wrote:
> 
> 
>>>>How is it I can run m_pORB->run() for each window if in fact there is
>>>>just one orb?  What is really happening when I call m_pORB->run() for
>>>>each window?
>>>
>>>Absolutely nothing. The thread from which you call run() just blocks
>>>waiting for the ORB to be destroyed. Any number of threads can be
>>>blocked in run(), but none of them will do anything.
>>
>>Right, but since each window has a gui, that gui expects not to be
>>blocked.  So I need to create a separate thread to be blocked by
>>ORB::run() all the while the gui is running on happily.
> 
> 
> No you don't. You don't need to call ORB::run(). At all. Ever.
> 

Ok, I believe you :-)

> 
>>>omniORB always creates its own threads to handle incoming calls and do
>>>all the other things the ORB needs to do. You do not need to call
>>>ORB::run() at all. There is no "event loop" for you to run.
>>
>>hmm, now I'm really confused... you don't need to call ORB:run() at
>>all? How does it start listening for incoming calls then?
> 
> 
> You don't need to call ORB::run(). omniORB has its own threads. When you
> call ORB_init() (and various other methods), omniORB starts its threads.
> They stay running until you call ORB::destroy(). Run your server with
> command line arguments -ORBtraceLevel 20 -ORBtraceThreadId 1. Amongst
> other things, you'll see lots of messages about threads being started.
> 
> 
>>My client has a base window.  From that window I can open new
>>windows. These new windows are the ones I'm talking about above.  When
>>a new window opens, it makes a CORBA call to another server
>>application(not mentioned here).  Its call tells the server that it
>>can send commands to that new window (i.e. it gives the server it's
>>IOR).  It then starts up its ORB instance and waits for commands.  The
>>server using that window's unique IOR can then send commands to that
>>specific window.
>>
>>Why I'm doing this is beyond the scope of this conversation... I guess
>>you can just trust that the server knows all the windows on the client
>>by each windows IOR.  And it needs the ability to send messages to an
>>individual window by that IOR.
> 
> 
> OK. So each window has an associated CORBA object that the server can
> call back to. That's a very common situation.
> 
> 
>>  To achive this, each window needs it's own CORBA server running to
>>listen for the incoming commands.
> 
> 
> No it doesn't. The whole process is a CORBA server. Each window has an
> associated object. You just have multiple activated objects in your
> server.
> 
> Simply initialise the ORB and POA once when the client program starts
> up, then activate as many objects as you need. All those objects will be
> contactable without you having to do anything else.
> 

hmm.. OK.  That seems to make sense.  I'll have to do some modifications 
to test this out.  Thanks for your help.  I'll let you know if it works 
out... or if I have any other questions.

-Jason




More information about the omniORB-list mailing list