About JDK-6772009

chen zero stzdzyhs at gmail.com
Thu Jan 5 04:02:11 UTC 2017


Hi,
About the JDK-6772009, https://bugs.openjdk.java.net/browse/JDK-6772009
after some testing, I think the reason is because:

in the run() function,
public final void run() {
     .......

     /*
      * in the main thread, two threads are un-interrupted, others threads
are interrupted.
      * this line, however, can not guarantee that only "un-interrupted"
threads can go in,
      * but also interrupted threads can go in,
      * so, the "completed" will not always == 2, might be > 2
      */
     if (n <= 0) {
         lock.lock();
         try {
             ++completed;
         }
         finally {
             lock.unlock();
         }
     }
     ........
}


because the mixing of BrokenBarrierException or InterruptedException that
make the test case very complex,
I change the code of this test case in attachment, please review.

Thanks.
chenzero


More information about the core-libs-dev mailing list