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/06/01 17:29:18 UTC
[jira] [Closed] (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 closed POOL-283.
----------------------------
Fix released in 2.4.1
> '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.1
>
>
> 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)