On 12/15/2014 06:38 PM, Daniel Fuchs wrote:
On 12/12/14 09:56, shanliang wrote:
Updated.

Here is the new version:
http://cr.openjdk.java.net/~sjiang/JDK-8067241/01/

Thanks,
Shanliang

Hi Shanliang,

Your changes looks good to me. WRT using a Phaser, it would
require a careful analysis to assert that modifying the
locking strategy - especially things like
   90             synchronized(o) {
   91                 synchronized(this) {
   92                     gotLock = true;
   93
   94                     this.notify();
   95                 }
still preserve the nature of the test.
I wonder if it's worth the trouble.

Well, the test tries to achieve step-by-step execution of two concurrent threads where one thread can only proceed when the other one has already reached a predefined execution point. This is exactly what the Phaser is fit for. Please note that by using Phasero one could also get rid off the Thread.sleep(<really big number>) construct to simulate the fact that the BadBoy thread doesn't finish before the main thread had the chance to assert the postconditions.

But the change is already in .. what is done is done. It's just a pity we missed the chance to improve the test a bit while fixing this issue.

-JB-


best regards,

-- daniel

Reply via email to