I added (but have not yet committed) the following test case to validate the WHEN_EXHAUSTED_GROW contract.

public void testWhenExhaustedGrow() throws Exception {
       pool.setMaxActive(1);
       pool.setMaxTotal(1);
       pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
       for (int i = 0; i < 10; i++) {
           pool.borrowObject("a");
       }
   }

This test causes an NPE in borrowObject.  I suspect the problem is here:

if (null == latch.getPair()) {
               try {
                   Object obj = _factory.makeObject(key);
                   latch.setPair(new ObjectTimestampPair(obj));
                   newlyCreated = true;

In this case, the latch may not at this point have a pool associated with it, so when later on we do

latch.getPool().decrementInternalProcessingCount();

we get NPE On the pool. Do we even want to do the decrement in this case? Do we need to force an allocate() somewhere? Should the Latch(key) constructor find or create the pool and assign it?

Phil





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to