[
https://issues.apache.org/jira/browse/DBCP-390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark Thomas resolved DBCP-390.
------------------------------
Resolution: Cannot Reproduce
>From the description provided I can't reproduce this. All the code paths I can
>see where a Factory might return a null connection trigger an ISE.
Please feel free to re-open this issue if you can provide a JUnit test case
that demonstrates the issue.
Note that this issue will not affect DBCP 2.x as it depends on Pool 2.x that
implements full object tracking and is therefore able to keep a better tracl of
the number of active and idle objects.
> calling invalidObject(badConnection) damage the counting of the objects in
> the pool.
> -------------------------------------------------------------------------------------
>
> Key: DBCP-390
> URL: https://issues.apache.org/jira/browse/DBCP-390
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.4
> Environment: All env
> Reporter: neng xu
>
> We are using DBCP pool. The pattern of using DBCP pool is same as Apache
> DBCP pool example PoolingDataSourceDataSourceExample.java. When cleaning bad
> connections, I noticed that it called pool.invalidObject(object) method to
> clean the bad connection object from the pool. Recently we found that
> calling invalidObject(object) could damage the number of active connections
> of the pool because this method always silently reduce the number
> regardless the objects was removed from pool or not. For example, when the
> connection object is null (creating database connection timeout happens),
> calling invalidObject(badConnection) would cause the number of Active
> connections to be reduce one even the method did not remove any object from
> pool. This damage the counting of the object in the pool.
> This method should only reduce the number of the objects in the pool when it
> successfully removed an object from the pool.
> Note: I understand that we may resolve the problem by checking object is null
> (or object is in pool) before calling invalidObject() method. But I think it
> is just a first-aid solution.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)