Have you tried marking the boolean as volatile? 


-----Original Message-----
From: Juliano [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 4 March 2007 10:52 AM
To: JMeter Developers List
Subject: Thread Sinchronization

I'm developing a new assertion listener.
it calculates the average of the sample times that arrive on*
AssertionResult getResult(SampleResult) *method. Depending on the
average time, it does something or not.

When the average time reaches the defined value a boolean is set to
true, but the other threads take some delay to realize this happened and
continue for a while.
For example:
If at the 5 delivered sampleResult the specified value was reached, it
continues until all remaining threads realize that.

The method seems something like:

*public AssertionResult getResult(SampleResult response) { ____
calculate(response);  // calculate the average. this is a synchronized
method ____ if( ! averageReached ){ ________ //do somethings ____}

____ return assertionResult;
}

*
I tried to synchronize the methods which set the boolean value. Tried to
synchronize the whole getResult method. Tried to insert some
Thread.delay() at the top. But still got no lucky.

The boolean value is a static field.

Any ideas are welcome.

Thanks


---------------------------------------------------------------------
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]

Reply via email to