You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/05/11 14:16:47 UTC

[jira] [Created] (POOL-188) Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?

Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?
----------------------------------------------------------------------------------------------------------------------------

                 Key: POOL-188
                 URL: https://issues.apache.org/jira/browse/POOL-188
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Sebb


numIdle(key) is equivalent to PoolUtils.ErodingKeyedObjectPool.getNumIdle() - unless the method getKeyedPool() is overridden.

It's confusing that the key parameter is not used - this may be the cause of a bug, as the method is used internally by ErodingKeyedObjectPool.returnObject(K key, V obj).

It looks like returnObject() should probably call getNumIdle(key) rather than numIdle(key).
In which case the confusing numIdle method can be deleted.



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (POOL-188) Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031668#comment-13031668 ] 

Sebb commented on POOL-188:
---------------------------

Turns out that the method is overridden by the subclass PoolUtils.ErodingPerKeyKeyedObjectPool.numIdle(K key) which calls getKeyedPool().getNumIdle(key) - i.e. behaves the same as the parent genNumIdle().

Very confusing (though it appears not to be used).

If ErodingKeyedObjectPool.numIdle(key) really is supposed to ignore the key, then either this should be carefully documented, or (better) the caller should use the appropriate method in the first place.



> Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: POOL-188
>                 URL: https://issues.apache.org/jira/browse/POOL-188
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Sebb
>
> numIdle(key) is equivalent to PoolUtils.ErodingKeyedObjectPool.getNumIdle() - unless the method getKeyedPool() is overridden.
> It's confusing that the key parameter is not used - this may be the cause of a bug, as the method is used internally by ErodingKeyedObjectPool.returnObject(K key, V obj).
> It looks like returnObject() should probably call getNumIdle(key) rather than numIdle(key).
> In which case the confusing numIdle method can be deleted.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (POOL-188) Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/POOL-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated POOL-188:
----------------------

    Attachment: POOL-188.patch

Patch to remove numIdle methods and change returnObject to use getNumIdle(key)

> Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: POOL-188
>                 URL: https://issues.apache.org/jira/browse/POOL-188
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Sebb
>         Attachments: POOL-188.patch
>
>
> numIdle(key) is equivalent to PoolUtils.ErodingKeyedObjectPool.getNumIdle() - unless the method getKeyedPool() is overridden.
> It's confusing that the key parameter is not used - this may be the cause of a bug, as the method is used internally by ErodingKeyedObjectPool.returnObject(K key, V obj).
> It looks like returnObject() should probably call getNumIdle(key) rather than numIdle(key).
> In which case the confusing numIdle method can be deleted.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (POOL-188) Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/POOL-188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved POOL-188.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0
         Assignee: Mark Thomas

> Confusing PoolUtils.ErodingKeyedObjectPool.numIdle(K key) method; bug in ErodingKeyedObjectPool.returnObject(K key, V obj) ?
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: POOL-188
>                 URL: https://issues.apache.org/jira/browse/POOL-188
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Sebb
>            Assignee: Mark Thomas
>             Fix For: 2.0
>
>         Attachments: POOL-188.patch
>
>
> numIdle(key) is equivalent to PoolUtils.ErodingKeyedObjectPool.getNumIdle() - unless the method getKeyedPool() is overridden.
> It's confusing that the key parameter is not used - this may be the cause of a bug, as the method is used internally by ErodingKeyedObjectPool.returnObject(K key, V obj).
> It looks like returnObject() should probably call getNumIdle(key) rather than numIdle(key).
> In which case the confusing numIdle method can be deleted.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira