destructors, how?

Ragnar Hojland Espinosa squeak-dev at lists.squeakfoundation.org
Wed Oct 23 08:34:27 UTC 2002


On Wed, Oct 23, 2002 at 01:41:56AM +0200, Peter Schuller wrote:
> > No magic, as theres no pooling yet :)  My issue is that "know when
> > connections should be closed" is when the db handle is ready to be GCed.. so
> > I thought I would just use some "destructors" and all would be easy.. but
> > there are none.  So I'm not really sure on how to figure out when I should
> > close a connection, unless I explicitely close it. 
> 
> Correct me if I'm overlooking something, but it seems to me you have a
> bigger question - how do you know when your application is done with a
> connection and that it can be used by the pool again?

Right now I don't.  The idea was roughly

      on_destruction =>  global_pool remove: self

which would work nicely for my needs.   I'll have to do something similar
with the block construct posted earlier.

> If you are to implement a connection pool you will by definition have
> to keep track of when "checked out" connections are no longer used,
> in order for the pool to be able to re-use the connection - or close
> it. So if you have a working pool, your problem is solved.

Indeed.. but I don't :)

-- 
Ragnar Hojland - Project Manager
Linalco "Especialistas Linux y en Software Libre"
Tel: +34-91-5970074 Fax: +34-91-5970083



More information about the Squeak-dev mailing list