My misunderstanding ... I've always thought that pre- and post-increment operations were atomic. Must be a difference in VMs or OSes that makes it fail consistently (I run these tests dozens of times a day). I'll add in the synchronized keyword and we'll see.
On Fri, 20 Aug 2004 09:55:12 +0200, Johan Lindquist <[EMAIL PROTECTED]> wrote: > Guess it was working after all - just extremely slowly :) > > Johan > > On Fri, 20 Aug 2004 09:45:20 +0200, Johan Lindquist <[EMAIL PROTECTED]> > wrote: > > > > > Howard, > > > > Tried to add a comment to the JIRA about HIVEMIND-44 but it was > > hopelessly down this morning, so i'll mail it here instead ... > > > > I pulled the latest code out of CVS and the test > > "TestServiceModelThreading" consistently fails with something like: > > > > [junit] Number of executions of the RunnableFixture expected:<200> but > > was:<198> > > > > While looking at what the test does, I saw that you have put a comment > > on the run method of the RunnableFixture class saying that you don't > > have to synchronize the increment. I think you would have to > > synchronize it as the increment operation involves both a read AND a > > write, making it non-atomic. > > > > Anyway, to cut it short, adding a synchronized block around the > > increment operation fixes the test ... > > > > Of course, I may be fixing the test rather than the problem, in which > > case it may need some more investigation ... > > > > Johan > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator, Jakarta Tapestry Creator, Jakarta HiveMind http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
