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

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

# Line 440 | Line 440 | public class LinkedBlockingQueueTest ext
440          final CountDownLatch aboutToWait = new CountDownLatch(1);
441          Thread t = newStartedThread(new CheckedRunnable() {
442              public void realRun() throws InterruptedException {
443 +                long startTime = System.nanoTime();
444                  for (int i = 0; i < SIZE; ++i) {
444                    long t0 = System.nanoTime();
445                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
446                    assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
446                  }
448                long t0 = System.nanoTime();
447                  aboutToWait.countDown();
448                  try {
449 <                    q.poll(MEDIUM_DELAY_MS, MILLISECONDS);
449 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
450                      shouldThrow();
451                  } catch (InterruptedException success) {
452 <                    assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
452 >                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
453                  }
454              }});
455  
456 <        aboutToWait.await();
457 <        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
456 >        await(aboutToWait);
457 >        waitForThreadToEnterWaitState(t, LONG_DELAY_MS);
458          t.interrupt();
459 <        awaitTermination(t, MEDIUM_DELAY_MS);
459 >        awaitTermination(t);
460          checkEmpty(q);
461      }
462  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines