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

Comparing jsr166/src/test/tck/LinkedBlockingDequeTest.java (file contents):
Revision 1.75 by jsr166, Sat May 13 23:50:00 2017 UTC vs.
Revision 1.76 by jsr166, Sun May 14 00:48:20 2017 UTC

# Line 756 | Line 756 | public class LinkedBlockingDequeTest ext
756       */
757      public void testInterruptedTimedPoll() throws InterruptedException {
758          final BlockingQueue<Integer> q = populatedDeque(SIZE);
759 <        final CountDownLatch aboutToWait = new CountDownLatch(1);
759 >        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
760          Thread t = newStartedThread(new CheckedRunnable() {
761              public void realRun() throws InterruptedException {
762                  long startTime = System.nanoTime();
763                  for (int i = 0; i < SIZE; ++i) {
764                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
765                  }
766 <                aboutToWait.countDown();
766 >
767 >                pleaseInterrupt.countDown();
768                  try {
769                      q.poll(LONG_DELAY_MS, MILLISECONDS);
770                      shouldThrow();
771 <                } catch (InterruptedException success) {
772 <                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
773 <                }
771 >                } catch (InterruptedException success) {}
772 >                assertFalse(Thread.interrupted());
773 >
774 >                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
775              }});
776  
777 <        await(aboutToWait);
777 >        await(pleaseInterrupt);
778          assertThreadBlocks(t, Thread.State.TIMED_WAITING);
779          t.interrupt();
780          awaitTermination(t);
# Line 1076 | Line 1078 | public class LinkedBlockingDequeTest ext
1078                      shouldThrow();
1079                  } catch (InterruptedException success) {}
1080                  assertFalse(Thread.interrupted());
1081 +
1082                  assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
1083              }});
1084  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines