ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/PhaserTest.java
(Generate patch)

Comparing jsr166/src/test/tck/PhaserTest.java (file contents):
Revision 1.46 by jsr166, Sat May 13 23:05:02 2017 UTC vs.
Revision 1.51 by dl, Tue Jan 26 13:33:06 2021 UTC

# Line 261 | Line 261 | public class PhaserTest extends JSR166Te
261       * the phase number increments correctly when tripping the barrier
262       */
263      public void testPhaseIncrement1() {
264 <        for (int size = 1; size < nine; size++) {
264 >        for (int size = 1; size < 9; size++) {
265              final Phaser phaser = new Phaser(size);
266              for (int index = 0; index <= (1 << size); index++) {
267                  int phase = phaser.arrive();
# Line 453 | Line 453 | public class PhaserTest extends JSR166Te
453      /**
454       * awaitAdvanceInterruptibly blocks interruptibly
455       */
456 <    public void testAwaitAdvanceInterruptibly_interruptible() throws InterruptedException {
456 >    public void testAwaitAdvanceInterruptibly_Interruptible() throws InterruptedException {
457          final Phaser phaser = new Phaser(1);
458          final CountDownLatch pleaseInterrupt = new CountDownLatch(2);
459  
# Line 478 | Line 478 | public class PhaserTest extends JSR166Te
478              public void realRun() throws TimeoutException {
479                  Thread.currentThread().interrupt();
480                  try {
481 <                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
481 >                    phaser.awaitAdvanceInterruptibly(0, randomTimeout(), randomTimeUnit());
482                      shouldThrow();
483                  } catch (InterruptedException success) {}
484                  assertFalse(Thread.interrupted());
485  
486                  pleaseInterrupt.countDown();
487                  try {
488 <                    phaser.awaitAdvanceInterruptibly(0, 2*LONG_DELAY_MS, MILLISECONDS);
488 >                    phaser.awaitAdvanceInterruptibly(0, LONGER_DELAY_MS, MILLISECONDS);
489                      shouldThrow();
490                  } catch (InterruptedException success) {}
491                  assertFalse(Thread.interrupted());
# Line 493 | Line 493 | public class PhaserTest extends JSR166Te
493  
494          await(pleaseInterrupt);
495          assertState(phaser, 0, 1, 1);
496 <        assertThreadsStayAlive(t1, t2);
496 >        if (randomBoolean()) assertThreadBlocks(t1, Thread.State.WAITING);
497 >        if (randomBoolean()) assertThreadBlocks(t2, Thread.State.TIMED_WAITING);
498          t1.interrupt();
499          t2.interrupt();
500          awaitTermination(t1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines