[
https://issues.apache.org/jira/browse/POOL-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12855568#action_12855568
]
Phil Steitz commented on POOL-155:
----------------------------------
The issue is broader than the statement above and not really solvable without
changing the pool contract. Under the current contract, it is the cilent's
responsibility to ensure that objects are not returned to the pool twice in
sequence without a borrow in between and that only objects borrowed from the
pool can be returned or invalidated. To really resolve the broader issue
here, the pool contract would have to be extended to include verifying that
objects being returned or invalidated "belong" to the pool - i..e., have been
returned by a previous activation of borrowObject. This would require
significant change to pool implementations and likely changes to user-supplied
factory contracts as well.
I am +1 for additional clarification of javadoc to include clear warnings that
invoking invalidateObject on objects not borrowed from the pool and other
violations of the pool contract can corrupt pool counters. I am -0 on eventual
change to the contact, -1 on change before 2.0. So I propose that we resolve
by doc fixes for 1.5.5. We can reopen and mark as 2.0 if others feel strongly
that the pool contract should be extended to prevent client API abuse.
> 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.5.4
> Reporter: Sebb
>
> 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