commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (POOL-283) 'Object has already been retured to this pool or is invalid' for collections
Date Thu, 05 Feb 2015 19:46:36 GMT

    [ https://issues.apache.org/jira/browse/POOL-283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14307819#comment-14307819
] 

Thomas Neidhart edited comment on POOL-283 at 2/5/15 7:46 PM:
--------------------------------------------------------------

Using an IdentityHashMap would not require such wrapper objects.

Edit: currently a ConcurrentHashMap is used, so I guess this will not change, but maybe the
idea with the wrapper objects would be worth to consider.


was (Author: tn):
Using an IdentityHashMap would not require such wrapper objects.

> 'Object has already been retured 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
>
> 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)

Mime
View raw message