commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [pool] getNumActive returning -1
Date Mon, 06 Jun 2011 07:34:05 GMT
On 6/5/11 7:32 PM, Phil Steitz wrote:
> The AbandonedObjectPool test case that I just commented out in
> [dbcp] trunk is failing because GOP getNumActive returns -1.  My
> first thought was that this is a timing issue due to lack of
> synchronization in invalidate and general non-protection of
> _allObjects and _idleObjects; but I can't demonstrate this.  Looking
> into it now...

I found the problem. The test object class was not threadsafe,
resulting in multiple equal instances generated by the factory. 
This results in returnObject replacing rather than duplicating
instances in _allObjects, which causes _allObjects to have fewer
instances than _idleObjects.  We need to think about this setup a
little, as it will break if equal instances are ever generated by
object factories and in circulation at the same time.  I think it is
a reasonable expectation that distinct instances generated by object
factories must not be equal; but this is a new requirement and it
needs to be documented and we might want to consider a guard for it.

Phil
> Phil


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


Mime
View raw message