You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by Juliano <js...@terra.com.br> on 2007/03/04 01:51:36 UTC

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: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org