[omniORB] Garbage collection

Mike Olson Mike.Olson@fourthought.com
Wed, 14 Feb 2001 15:23:17 -0700


I was reading though the docs for omniNotify 1.1 and noticed a Portable
Servant called RefCountServantBase that the demo servants derive from. 
It seems that this deletes the servant when there are no more object
references to the servant.  

Two questions, would using this as a base class solve this problem?  And
secondly, if so when can we/how can we use this base class from omniPy?

Mike


Stefan Seefeld wrote:
> 
> Mike Mascari wrote:
> >
> > Hello.
> >
> > I have a session-oriented application which uses an object factory to
> > generate a transient session-specific object for each client connection. I
> > have read Michi Henning & Steve Vinoski's book regarding the various
> > tecniques of garbage collecting the servants when a client dies
> > unexpectedly, but none seem too pleasing. One of the methods they refer to
> > is the use of ORB proprietary extensions that allow the server code to
> > detect when a connection from a client goes down. Does omniORB have such an
> > extension? If not, what do people find the most reasonable way to garbage
> > collect session-specific servants after a client dies?
> 
> you may run a ping() from within your session object that makes sure the
> client is still alive, or you may just record the last time any data was
> exchanged.
> Second, you need to associate all server side objects that are created on
> behalf of the client, so you can destroy them all when the client has died.
> The technique we use for this is to allocate POAs per client, and activate
> all objects for that client with one of the POAs that are in use for it.
> This avoids the bookkeeping, as the POA will take down all objects it manages,
> if it is destroyed. Of course, you then need to use the PortableServer::RefCountBase
> to bind the servant lifetime to the object lifetime...
> 
> Regards,        Stefan

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python