destructors, how?
Peter Schuller
peter.schuller at infidyne.com
Tue Oct 22 23:41:56 UTC 2002
> 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?
However you solve your connection pool problem, you are going to have to
figure out a way for the connection pool to know when a connection is no
longer used and can be therefore be used for subsequent communication.
Once you know that, you're done. I am assuming your connection pool has
some form av maximum number of unused connections; in which case you
would just close excess connections when they are detected.
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.
(I won't repeat what's already been suggested with regards to re-using
connections.)
--
/ Peter Schuller, InfiDyne Technologies HB
PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller at infidyne.com>'
Key retrival: Send an E-Mail to getpgpkey at scode.org
E-Mail: peter.schuller at infidyne.com Web: http://www.scode.org
More information about the Squeak-dev
mailing list
|