--- Dirk Verbeeck <[EMAIL PROTECTED]> wrote: > The pool manipulation was synchronized, only the isEmpty() test is not. > I didn't realize that _numActive++ should be synchronized, I thought the > > ++ operator was atomic.
The datatype the operator is applied to is what matters. Assignments to ints are atomic, assignments to longs aren't because they are 64 bits. So, if _numActive is an int, I don't think it needs to be synchronized. David > I'll put these also in a synchronized block. > > http://cvs.apache.org/viewcvs/jakarta-commons/pool/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=1.23&content-type=text/vnd.viewcvs-markup > > How does this new version looks? > > Dirk > > John McNally wrote: > > >My quick read of this change is not favorable. It looks like changes > to > >an unsynchronized list have been moved outside any synchronization. > >Also integer math like numActive++ outside a synchronization block has > >got me into problems in the past. A test with two threads using i++ > and > >i-- ran quite some time (couple hours) on a single processor box, but > >did eventually fail. Then the test was run on a dual processor box, it > >failed pretty much immediately, repeatedly. > > > >I'm -1 on this change. > > > >john mcnally > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]