Hi all,
I'm coding the disposable wrappers just now. And I just wanted to run
some behaviour past everyone.
Connection c1 = DriverManager.getConnection(url);
c1.close();
Connection c2 = DriverManager.getConnection(url);
c2.close();
// This test will ALWAYS be false, even if the actual
// underlying connection is the same
if (c1.equals(c2)) {
// Never true!
}
Instinctively, this behaviour most closely matches the behaviour you'd
experience if you didn't have a pool at all.
However, I wonder whether it will cause problems with some systems.
Christian, some of your/my code relies on being able to identify the
same connection being used in a Map doesn't it? Any thoughts?
Note: I can code it either way. I'm just trying to work out which is the
sanest. The current (0.8.3) behaviour (because there are no disposable
wrappers) is:
if (c1.equals(c2)) {
// True if, by coincidence, you get the same underlying
// connection back
}
- Bill
|