On 06/06/2011 08:34, Phil Steitz wrote: > 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.
Good catch. I'm not sure I would have found that anywhere near that quickly. I'll look into putting a guard into pool for this. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org