Valentin Mayamsin created POOL-283:
--------------------------------------

             Summary: '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 Sets.newHashSet ();
            }

            @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<Interface> set1 = setsPool.borrowObject ();

        final Set<InterfaceQueue> 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)

Reply via email to