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.10 by jsr166, Tue Dec 1 10:03:59 2009 UTC vs.
Revision 1.11 by dl, Wed Dec 2 01:08:30 2009 UTC

# Line 465 | Line 465 | public class PhaserTest extends JSR166Te
465       */
466      public void testArriveAndAwaitAdvance3() throws InterruptedException {
467          final Phaser phaser = new Phaser(1);
468        final AtomicInteger arrivingCount = new AtomicInteger(0);
468          final List<Thread> threads = new ArrayList<Thread>();
469 <        for (int i = 0; i < 6; i++) {
469 >        for (int i = 0; i < 3; i++) {
470              threads.add(newStartedThread(new CheckedRunnable() {
471 <                public void realRun() throws InterruptedException {
472 <                    phaser.register();
473 <                    sleepTillInterrupted(SHORT_DELAY_MS);
474 <                    arrivingCount.getAndIncrement();
476 <                    phaser.arrive();
477 <                }}));
471 >                    public void realRun() throws InterruptedException {
472 >                        phaser.register();
473 >                        phaser.arrive();
474 >                    }}));
475          }
476 <        int phaseNumber = phaser.arriveAndAwaitAdvance();
477 <        arrivingCount.incrementAndGet();
478 <        //the + 1 adds to expectedArrive to account for the main threads arrival
482 <        int expectedArrived = phaseNumber > 0 ? phaseNumber * six + 1 : phaser.getArrivedParties() + 1;
483 <        assertEquals(expectedArrived, arrivingCount.get());
476 >        Thread.sleep(LONG_DELAY_MS);
477 >        assertEquals(phaser.getArrivedParties(), 3);
478 >        phaser.arrive();
479          for (Thread thread : threads)
480              thread.join();
481      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines