[
https://issues.apache.org/jira/browse/POOL-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12855587#action_12855587
]
Phil Steitz commented on POOL-155:
----------------------------------
What exception? NPE? IAE? Seems odd to handle only that case and also it is
possible this may break some working apps - i.e., apps that either
(incorrectly) null the reference and then call invalidate or user factories
that legitimately return null objects that get handed back to clients which
handle validation independently of the factory methods. In both of these
cases, decrementing numActive is correct and NPE/IAE would not be expected.
I am definitely sympathetic on the broader issue. The tradeoff is between a
simple contract and lightweight implementation (GOP does not hold references to
checked out objects, borrow/return do not have to do any equality checking and
borrow/return work with direct-from-the-factory objects - i.e., the client does
not have to unwrap/rewrap them) vs more robust error-prevention / instance
lifecycle management by the pool itself. We should discuss this for 2.0.
> ObjectPool.invalidateObject(object) should throw an Exception if object is
> null
> -------------------------------------------------------------------------------
>
> Key: POOL-155
> URL: https://issues.apache.org/jira/browse/POOL-155
> Project: Commons Pool
> Issue Type: Improvement
> Affects Versions: 1.0, 1.0.1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.5.1, 1.5.2,
> 1.5.3, 1.5.4
> Reporter: Sebb
> Fix For: 1.5.5
>
>
> ObjectPool.invalidateObject(object) should throw an Exception if object is
> null, otherwise the numActive count can get out of synch.
> It's easy to do this by mistake, see:
> http://markmail.org/thread/ya22ihmghejbfzme
> Also, the documentation for ObjectPool needs to be updated to clarify that
> invalidateObject should only be called if the object failed, not the borrow.
> [I'll do this shortly]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira