[ 
https://issues.apache.org/jira/browse/POOL-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Phil Steitz updated POOL-285:
-----------------------------
    Affects Version/s: 2.0
                       2.1
                       2.2
                       2.3
        Fix Version/s: 2.4

Good catch.  I think this actually applies to GOP as well.  The early check and 
markReturning call in GOP is only performed when abandoned object tracking is 
enabled.  I think the following block should be executed after the null check 
on p, unconditionally at the top of returnObject for both GOP, GKOP.  If I 
don't hear objections, I will commit this change to both classes and add a test 
to verify that multiple returns generate exceptions but don't repassivate 
objects in the pool.

{code}
synchronized(p) {
    final PooledObjectState state = p.getState();
    if (state != PooledObjectState.ALLOCATED) {
        throw new IllegalStateException(
            "Object has already been returned to this pool or is invalid");
    } else {
        p.markReturning(); // Keep from being marked abandoned
    }
}
{code}

> GenericKeyedObjectPool.returnObject() checks for idle object too late
> ---------------------------------------------------------------------
>
>                 Key: POOL-285
>                 URL: https://issues.apache.org/jira/browse/POOL-285
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 2.2, 2.3
>            Reporter: Sebb
>             Fix For: 2.4
>
>
> GenericKeyedObjectPool.returnObject() checks if the object was already 
> returned to the pool after it has performed validation (if reqd) and after 
> the object has been passivated.
> This seems wrong - surely if the object has already been returned to the pool 
> it should not be validated or passivated again?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to