You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2015/05/12 15:36:00 UTC

[jira] [Resolved] (POOL-283) 'Object has already been returned to this pool or is invalid' for collections

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

Phil Steitz resolved POOL-283.
------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4

Fixed in r1678941
See resolution comments on POOL-284

> 'Object has already been returned to this pool or is invalid' for collections
> -----------------------------------------------------------------------------
>
>                 Key: POOL-283
>                 URL: https://issues.apache.org/jira/browse/POOL-283
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Valentin Mayamsin
>             Fix For: 2.4
>
>
> This test throws exception:
> {code}
>  GenericObjectPoolConfig config = new GenericObjectPoolConfig ();
>         config.setMaxTotal ( 2 );
>         GenericObjectPool<Set> setsPool = new GenericObjectPool<> ( new BasePooledObjectFactory<Set> ()
>         {
>             @Override
>             public Set create () throws Exception
>             {
>                 return new HashSet();
>             }
>             @Override
>             public PooledObject<Set> wrap ( Set o )
>             {
>                 return new DefaultPooledObject<> ( o );
>             }
>             @Override
>             public void passivateObject ( PooledObject<Set> p ) throws Exception
>             {
>                 p.getObject ().clear ();
>                 super.passivateObject ( p );
>             }
>         }, config );
>         final Set set1 = setsPool.borrowObject ();
>         final Set set2 = setsPool.borrowObject ();
>         setsPool.returnObject ( set1 );
>         setsPool.returnObject ( set2 ); // this throws java.lang.IllegalStateException: Object has already been retured to this pool or is invalid
> {code}



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