code: public synchronized T borrow() throws JMSException
  	{
  		if (closed)
  			throw new ObjectPoolException("Object pool is closed");
  		
  		// Object immediately available ?
  		int availableCount = available.size();
  		if (availableCount > 0)
  			return available.remove(availableCount-1);
  		
  		// Can we create one more ?
  		if (all.size() < maxSize)
  			return extendPool();
  		
  		// Pool is exhausted
  		switch (exhaustionPolicy)
  		{
  			case WHEN_EXHAUSTED_FAIL  : throw new ObjectPoolException("Pool is exhausted (maxSize="+maxSize+")");
  			case WHEN_EXHAUSTED_BLOCK : return waitForAvailability();
  			case WHEN_EXHAUSTED_WAIT  : return waitForAvailability(waitTimeout,true);
  			case WHEN_EXHAUSTED_RETURN_NULL : return null;
  			case WHEN_EXHAUSTED_WAIT_RETURN_NULL : return waitForAvailability(waitTimeout,false);
  			
  			default:
  				throw new ObjectPoolException("Invalid exhaustion policy : "+exhaustionPolicy);
  		}
  	}
docs: Borrow an object from the pool
  @return a pooled object