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

Comparing jsr166/src/test/tck/LinkedTransferQueueTest.java (file contents):
Revision 1.81 by jsr166, Mon May 28 21:19:50 2018 UTC vs.
Revision 1.82 by jsr166, Sun Aug 11 22:29:27 2019 UTC

# Line 227 | Line 227 | public class LinkedTransferQueueTest ext
227              }});
228  
229          await(pleaseInterrupt);
230 <        assertThreadBlocks(t, Thread.State.WAITING);
230 >        if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
231          t.interrupt();
232          awaitTermination(t);
233      }
# Line 287 | Line 287 | public class LinkedTransferQueueTest ext
287  
288                  Thread.currentThread().interrupt();
289                  try {
290 <                    q.poll(LONG_DELAY_MS, MILLISECONDS);
290 >                    q.poll(randomTimeout(), randomTimeUnit());
291                      shouldThrow();
292                  } catch (InterruptedException success) {}
293                  assertFalse(Thread.interrupted());
# Line 303 | Line 303 | public class LinkedTransferQueueTest ext
303              }});
304  
305          await(pleaseInterrupt);
306 <        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
306 >        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
307          t.interrupt();
308          awaitTermination(t);
309          checkEmpty(q);
# Line 320 | Line 320 | public class LinkedTransferQueueTest ext
320                  long startTime = System.nanoTime();
321                  Thread.currentThread().interrupt();
322                  for (int i = 0; i < SIZE; ++i)
323 <                    assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
323 >                    assertEquals(i, (int) q.poll(randomTimeout(), randomTimeUnit()));
324                  try {
325 <                    q.poll(LONG_DELAY_MS, MILLISECONDS);
325 >                    q.poll(randomTimeout(), randomTimeUnit());
326                      shouldThrow();
327                  } catch (InterruptedException success) {}
328                  assertFalse(Thread.interrupted());
# Line 958 | Line 958 | public class LinkedTransferQueueTest ext
958                  long startTime = System.nanoTime();
959                  Thread.currentThread().interrupt();
960                  try {
961 <                    q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
961 >                    q.tryTransfer(new Object(), randomTimeout(), randomTimeUnit());
962                      shouldThrow();
963                  } catch (InterruptedException success) {}
964                  assertFalse(Thread.interrupted());
# Line 969 | Line 969 | public class LinkedTransferQueueTest ext
969                      shouldThrow();
970                  } catch (InterruptedException success) {}
971                  assertFalse(Thread.interrupted());
972 +
973                  assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
974              }});
975  
976          await(pleaseInterrupt);
977 <        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
977 >        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
978          t.interrupt();
979          awaitTermination(t);
980          checkEmpty(q);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines