[omniORB] Client crash notification & Smart Proxies

JohnSwanStone JohnSwanStone@hotmail.com
Wed, 20 Dec 2000 16:27:29 -0500


Stefan,

Thanks for you reply.

I'd like to avoid forcing the clients into using a RefCount_var type holder
which can be error prone (i.e. very easy to forget to use it) ... instead
I'd like to provide smart proxies which do the same thing.  I'm not
concerned with portability ... I'm willing to rewrite the smart proxies for
each new ORB.

What I'd like to know is how can one create "smart" proxies in omniORB?

I'd also like to know if there is any omniORB specific notification that can
be given to the server whenever a client crashes?  I'd like to avoid the
polling-the-client method you suggested.  It's my understanding that when
one end of a TCP/IP connection crashes the other is notified.  Does omniORB
do anything with this notification? Can I get a hook into it?

I also understand that omniORB supports a TCP/IP connection per request,
which after a time are closed.  Can I configure omniORB to always keep at
least 1 connection open for each unique client?  That way I could receive
the TCP/IP connection closed message I spoke about in the previous
paragraph.

Again, thanks for you prompt reply.

John.

----- Original Message -----
From: "Stefan Seefeld" <seefelds@MAGELLAN.UMontreal.CA>
To: "JohnSwanStone" <JohnSwanStone@hotmail.com>
Cc: <omniorb-list@uk.research.att.com>
Sent: Wednesday, December 20, 2000 2:25 PM
Subject: Re: [omniORB] Client crash notification & Smart Proxies


> > JohnSwanStone wrote:
>
> > a) How do you create smart proxies in omniORB.  The only info I've found
refers to a section
> > in the user's manual which doesn't have that information anymore
(Section 8.2).
>
> you should use some form of distributed ref counting, i.e. derive your
servants from an
>
> interface RefCountBase
> {
>   void increment();
>   void decrement();
> };
>
> Of course, you need to call these methods explicitely. There is no
portable way to add that
> to proxy classes. However, what I did to get a similar effect, is to write
a smart pointer
> template, something like this:
>
> template <typename Interface>
> class RefCount_var
> {
> public:
>   RefCount_var(typename Interface::_type_ptr i) : _i(i) {}
>  ~RefCount_var()
>     {
>       if (!CORBA::is_nil(_i))
>         try { _i->decrement();}
>         catch (...) {}
>     }
> //...
> }
>
> which you can use like smart proxies:
>
> RefCount_var<SomeObject> object = ...; // assumes ownership like 'normal'
vars...
>
> > b) How can I ask omniORB to notify me when a client crashes ... I would
also need a client
> > identifier so I could look up the and release the resources that client
was using.
>
> Again, a solution we use:
> For each client there is a pair of ServerContext/ClientContext which
serves as a 'session'
> pair, responsible for authentication as well as other housekeeping stuff.
The ServerContext
> lives in the server, the ClientContext in the client. A special thread
pings all existing
> ClientContexts, and as soon as one times out (well, whatever policy you
want), all the
> resources the server allocated on behalf of the client are freed. In our
case we use client
> specific POAs, so all we need is destroy the POAs belonging to a client.
With the
> PortableServer::RefCountBase mixed into the inheritance for all servants,
this deletes all
> servants as well.
>
> Regards, Stefan
> _______________________________________________________
>
> Stefan Seefeld
> Departement de Physique
> Universite de Montreal
> email: seefelds@magellan.umontreal.ca
>
> _______________________________________________________
>
>       ...ich hab' noch einen Koffer in Berlin...
>