[omniORB] Wait for thread to complete (oneway calls)
Frédéric Prin
frederic.prin@silvaco.com
Tue, 11 Dec 2001 13:15:47 +0100
Hi all,
I have to minimize the use of corba services. So I use the
- omniINSPOA (to avoid name service), and the
- callback design pattern (to avoid event or notification service)
I have a problem with my Client/server C++ (omnniORB 3.0.4) app. It's not
really a problem with omniORB but more a MX general design pb:
My client act as a server since it has a callback object called by the
server.
The client calls n times the server method.
The server method calls back the client callback method (1 time).
If the callback method is a twoway call : it works
If it is a oneway call (this is what I want): the client process exit while
the callback, handled by orb threads, are not run.
An error is printed : omniORB: An exception has occured and was caught by
tcpSocketMT Worker thread.
I know I can avoid the pb with twoway calls, but I need asynchronous call
provided by oneway.
Also, I do not want to use a SINGLE_THREAD poa policy.
(But I'm affraid your respons will be to avoid using oneway (because of
their unreliability! In fact, I wonder why the OMG specify unreliable
things!!! )
My questions :
------------
Is there a mean to make the main process wait for its thread completion
(like it is with Orbacus4 and the JTCThread) ?
Is it managed by a special ommni_thread method ?
Do I have to manage blocking main thread with my own mean (process) waiting
for ORB thread completion ? If yes could you briefly explain me how ?
Thanks for reading. If you need more details, see below.
More details:
------------
The server exports one object (called MyObject) and the client exports one
object (called MyClient)
The server side object interface is made of these methods
--------------------------------------
#include "ClientNotifySink.idl"
interface ServerObj
{
void Subscribe(in NotifySink sink);
long Method(in long lParam);
void shutdown();
};
--------------------------------------
The client side interface is made of 1 method
--------------------------------------
interface NotifySink
{
[oneway] void Notify(in long mydata);
};
--------------------------------------
The algorythm is as follow:
1) Server creates and activates, via omniINSPOA, an object nammed
"MyObject".
2) Client creates and activates the callback object "MyClient"
3) Client narrow (with string_to_object(corbaloc name)) the MyObject object.
4) Clients send the MyClient object reference (a NotifySink_var) with
subscribe server method
5) Clients call 10 times the server Method() method
6) Server call the client's Notify method
7) Clients exit from main (even if callback are not handled)
The proto works when debug it in step by step but do not work in real
runtime. It finish with error:
omniORB: An exception has occured and was caught by tcpSocketMT Worker
thread.
All my method (server side and callback client side) has printf trace to
debug them.
_____________________________
/ /|
/___________________________ / |
| | |
| Frédéric Prin | |
| Senior Software Engineer | |
| S I L V A C O | |
| Grenoble REsearch CEnter | |
| Tel 04 56 38 10 33 | /|
|____________________________|/ /
/__/__/__/__/__/__/__/__/__/__/ /
/__/__/__/__/__/__/__/__/_____/ /
/__/__/__/__/__/__/__/__/__/__/ /
\_____________________________|/