destructors, how?

Yanni Jew squeak-dev at lists.squeakfoundation.org
Wed Oct 23 01:52:31 UTC 2002


Ragnar Hojland Espinosa wrote:
> The thing is.. I'm leaving behind lots open postgres connections which would
> be nicely closed with a "destructor", and right now I don't know how to
> automatically close (maybe you cant?) when it should (the sooner the
> better). Obviously, postgres complains quite loudly when you have too many
> open, and things suddely get very ugly.
> 
> Ah well.. at least I can add the closes by hand :/  but that means leaks
> and sort of rules out to have decent db connection pools in any way I can
> think of.. so I must be missing something.

pgsqueak-0.7.0 has been stuck at 0.7 for over a year.
Improved error handling is on the todo list, the design
intent is that the connection object would keep track
of the connection state, and re-connect if necessary.
A connection pool manager would hold a bunch of these
connections.

In the absence of a connection pool, I used a singleton.
I would terminate the connection, before re-starting it.
If the connection were already bad (maybe because I'd
just restarted the image), then you'd get an error
right away. Ignore the error, and restart the connection.
IIRC, you might have to tweak things because the socket may
be dead, but the connection object has not nil'ed out
its socket instance var.

--yanni



More information about the Squeak-dev mailing list