[omniORB] unbinding an object
baileyk at schneider.com
baileyk at schneider.com
Tue Dec 2 15:51:51 GMT 2003
I can comment on what I do to accomplish your goals. I'm not sure if you
mentioned platform or not, I don't have any Windows based servers so the
signal stuff only applies to Unix-like systems.
To handle bindings to transient objects in the name service, I have a
utility library that does several things
1. Initialized the orb and provides a singleton-like API to get the one ORB
instance
2. Provides an API to publish transient references to the default context
or any other naming context
3. Provides a signal handling framework so that SIGTERM and similar cause
orb->shutdown() to be called in another thread
4. Keeps a list of "atShutdown" functors to call just prior to calling
orb->shutdown()
5. Automatically registers unbind functors for each transient reference.
It would be nice if all this was standardized, but its not. The only way
for orb->run() to return nicely is if another thread calls orb->shutdown().
But once its shutdown, you can not make remote calls to the name service to
unbind your references. Thus I provide for a way to get arbitrary code to
execute just before the shutdown occurs.
Number 2 above does nice things like create intermediate contexts if they
are missing. This way I can wipe the entire name tree and just rerun the
servers to rebuild a complex name tree from scratch.
I'm afraid I can't just send you this library, but if you have trouble
rolling your own I can try to answer any detailed questions about the
implementation. I won't be much good with Windows-specifics though. You
might want to check the IONA site for their utility library. I haven't
studied it, but there are frequent posts to comp.object.corba about it (by
it's author) and it's supposed to be portable to other orb implementations.
Kendall
Johan Cronje
<jcronje at dsp.sun.ac.za> To: "Clarke Brunt" <clarke.brunt at yeomannavigation.co.uk>, "omniORB"
Sent by: <omniorb-list at omniorb-support.com>
omniorb-list-bounces at omniorb- cc:
support.com Fax to:
Subject: Re: [omniORB] unbinding an object
12/02/2003 03:10 PM
On Tuesday 02 December 2003 20:34, Clarke Brunt wrote:
> The naming service is just a standard CORBA service. Check what methods
it
> has. We seem to have stuff that does something like
> root_context->unbind(name) (where name is the same name object that was
> bound earlier).
I know about that method, but the problem with that is, I'd have to write a
separate app (or client method) to achieve that; I'd like it to happen when
my
server exits. Otherwise I'd have to keep track of when my server is down
and
unregister it myself.
> >Also, is there a way to make the last statement (cout) in the following
> Add a \n to the end of it (otherwise doesn't flush the output).
That's not the problem - calling orb->run() blocks forever on my system;
so the only way I can get my servant to exit is via ^C (Ctrl-c). And then,
of
course, the last statement isn't called. What I wanted to know is if there
is
a way for a servant to exit by some other means that _does_ let the
orb->run()
call finish and following statements execute.
A very ugly hack would be to raise an exception and insert any last
commands
that needs to carry out (like unregistering the object name) into either
the
exception handler or after all the exception handlers. But I'm pretty sure
there are more elegant solutions to the problem.
Thanks Anyway
Regards,
Johan
--
"There is beauty in simplicity" -- Johan Cronje
---------------------------------------------------------------
Johan Cronje
Digital Signal Processing / Telecommunications Group
Electrical and Electronic Engineering Department
University of Stellenbosch
http://www.dsp.sun.ac.za/~jcronje
---------------------------------------------------------------
GNUPG Key: http://www.dsp.sun.ac.za/~jcronje/jcronje.asc
More information about the omniORB-list
mailing list