I agree with John's idiom of putting the close() call in a finally block. I
think most people do it that way, which may be why this bug was never
uncovered before.
But I also think Anjan's right that this is a bug, and I've just corrected
the behavior and added a unit test that demonstrates.
I wrote:
I'm also a little confused as to
its purpose, but it shouldn't be too
difficult to do the wrapping at the
Pool level instead of the PoolableObjectFactory
(ConnectionFactory) level. This may
actually simplify a number of things, in
addition to making the behavior you
Guys, about the same problem is in BasicDataSource.
When we get datasource from JNDI (BasicDatasourceFactory)
we get DataSource type not BasicDataSource which is good (an abstraction
is provided)
But DataSource class doesn't have method close().
I wouldn't like to cast my DataSource instance to
Can't say that I use Connection.isClosed often if at all, nor that I fully
understand the use cases here.
Technically speaking, if the underlying connection isn't closed, then
PoolableConnection still has an open channel to the database. Does that
mean isClosed should return true?
I think
:32 PM
To: 'Jakarta Commons Developers List'
Subject: RE: [DBCP] : DelegatingConnection/PoolableConnection Bug ?
Can't say that I use Connection.isClosed often if at all, nor that I fully
understand the use cases here.
Technically speaking, if the underlying connection isn't closed
:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 1:32 PM
To: 'Jakarta Commons Developers List'
Subject: RE: [DBCP] : DelegatingConnection/PoolableConnection Bug ?
Can't say that I use Connection.isClosed often if at all, nor that I fully
understand the use cases here.
Technically speaking
: Tuesday, April 02, 2002 5:32 PM
To: Jakarta Commons Developers List
Subject: Re: [DBCP] : DelegatingConnection/PoolableConnection Bug ?
I'm not sure what is being proposed here, so if this is wrong let me
know. But code that is something like the following is not a good idea:
Connection con
Subject: Re: [DBCP] : DelegatingConnection/PoolableConnection Bug ?
I'm not sure what is being proposed here, so if this is wrong let me
know. But code that is something like the following is not a good idea:
Connection con = pool.getConnection();
...do something...
con.close
Anjan wrote:
Hi Rodney/John,
I'm not sure what is being proposed here, so if this is wrong let me
know. But code that is something like the following is not a good idea:
Connection con = pool.getConnection();
...do something...
con.close();
...
if (!con.isClosed())
con.close();