You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/09/23 12:17:24 UTC

[GitHub] [commons-pool] psteitz commented on issue #25: POOL-356 and POOL-376

psteitz commented on issue #25: POOL-356 and POOL-376
URL: https://github.com/apache/commons-pool/pull/25#issuecomment-534073666
 
 
   Nice work on the patch.  Here is a unit test that fails (with NPE) before this fix, illustrating the problem and succeeds after.
   
   ```
   /**
        * POOL-376
        */
       @Test(timeout = 60000)
       public void testNoInvalidateNPE() throws Exception {
           genericObjectPool.setMaxTotal(1);
           genericObjectPool.setTestOnCreate(true);
           genericObjectPool.setMaxWaitMillis(-1);
           String obj = genericObjectPool.borrowObject();
           // Make validation fail - this will cause create() to return null
           simpleFactory.setValid(false);
           // Create a take waiter
           final WaitingTestThread wtt = new WaitingTestThread(genericObjectPool, 200);
           wtt.start();
           // Give wtt time to start
           Thread.sleep(200);
           genericObjectPool.invalidateObject(obj);
           // Now allow create to succeed so waiter can be served
           simpleFactory.setValid(true);
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services