On 22/11/06, Steve Vinoski <[EMAIL PROTECTED]> wrote:
On Nov 22, 2006, at 4:11 PM, Steve Vinoski wrote:

> Anyone else noticed any flakiness with the java client
> MultipleConnectionTest? It just seems to randomly pass and fail on
> my machine. I tried doubling the timeout, and it still fails about
> half the time.

Changing the notifyAll() call to notify() in this test seems to do
the trick. It appears that only one thread can ever be waiting at any
one time, so notify() should be fine.

Sorry if I'm being really dim, but I don't quite understand what was
wrong in the test? I can see that notify should be fine for this test
but I don't see why notifyAll would cause the test to fail?

I ran the test on my branch and it did pass for me but I only have a
single core CPU on my laptop. What kind of hardware are you running
on?

As an aside, the comment on the test says it is slow but I think it
could be speeded up by modifying the loop so that it didn't wait
before checking the count, e.g.

long start = System.currentTimeMillis();
while (expected > _count)
{
   long timeLeft = maxWait - timeSince(start);
   if (timeLeft < 0)
   {
       break;
   }
   wait(timeLeft);
}
return expected <= _count;

I did that and the test passed in about 4 seconds rather than ~80.

I did also wonder if _count should be volatile.

RG

Reply via email to