commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Commented: (POOL-155) ObjectPool.invalidateObject(object) should throw an Exception if object is null
Date Sat, 10 Apr 2010 13:57:42 GMT


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:
>             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:
> 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:
For more information on JIRA, see:


View raw message