RE: Thread Sinchronization

2007-03-05 Thread John Neale
Hi,

Can you provide a bit more of your code so I can get a better understanding
of what you are trying to do? I don't understand where the boolean is being
set or where it is being checked.

Cheers,

John


-Original Message-
From: Juliano [mailto:[EMAIL PROTECTED] 
Sent: Monday, 5 March 2007 5:21 PM
To: JMeter Developers List
Subject: Re: Thread Sinchronization

Yes I have. But it didn't help.

Volatile modifier works on jvm cacheing issues isnt it?

Thanks Neale.

_
John Neale wrote:
 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]



   


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



RE: Thread Sinchronization

2007-03-04 Thread John Neale
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]



Re: Thread Sinchronization

2007-03-04 Thread Juliano

Yes I have. But it didn't help.

Volatile modifier works on jvm cacheing issues isnt it?

Thanks Neale.

_
John Neale wrote:
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]



  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Thread Sinchronization

2007-03-03 Thread Juliano

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]