[
https://issues.apache.org/jira/browse/POOL-283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sebb updated POOL-283:
----------------------
Summary: 'Object has already been returned to this pool or is invalid' for
collections (was: 'Object has already been retured to this pool or is invalid'
for collections)
> '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
>
> 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)