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

Comparing jsr166/src/test/tck/ArrayBlockingQueueTest.java (file contents):
Revision 1.68 by jsr166, Sun Oct 4 18:49:02 2015 UTC vs.
Revision 1.70 by jsr166, Tue Oct 6 00:03:55 2015 UTC

# Line 451 | Line 451 | public class ArrayBlockingQueueTest exte
451          final CountDownLatch aboutToWait = new CountDownLatch(1);
452          Thread t = newStartedThread(new CheckedRunnable() {
453              public void realRun() throws InterruptedException {
454 +                long startTime = System.nanoTime();
455                  for (int i = 0; i < SIZE; ++i) {
455                    long t0 = System.nanoTime();
456                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
457                    assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
457                  }
459                long t0 = System.nanoTime();
458                  aboutToWait.countDown();
459                  try {
460 <                    q.poll(MEDIUM_DELAY_MS, MILLISECONDS);
460 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
461                      shouldThrow();
462                  } catch (InterruptedException success) {
463 <                    assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
463 >                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
464                  }
465              }});
466  
467 <        aboutToWait.await();
468 <        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
467 >        await(aboutToWait);
468 >        waitForThreadToEnterWaitState(t, LONG_DELAY_MS);
469          t.interrupt();
470 <        awaitTermination(t, MEDIUM_DELAY_MS);
470 >        awaitTermination(t);
471          checkEmpty(q);
472      }
473  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines