mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8225490: Miscellaneous changes imported from jsr166 CVS 2019-09
Reviewed-by: martin, alanb
This commit is contained in:
parent
9275097a02
commit
eb1eadb69f
46 changed files with 622 additions and 640 deletions
|
@ -318,7 +318,7 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
|
|||
}});
|
||||
|
||||
await(pleaseInterrupt);
|
||||
assertThreadBlocks(t, Thread.State.WAITING);
|
||||
if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
|
||||
t.interrupt();
|
||||
awaitTermination(t);
|
||||
assertEquals(SIZE, q.size());
|
||||
|
@ -360,7 +360,7 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
|
|||
assertEquals(0, q.take());
|
||||
|
||||
await(pleaseInterrupt);
|
||||
assertThreadBlocks(t, Thread.State.WAITING);
|
||||
if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
|
||||
t.interrupt();
|
||||
awaitTermination(t);
|
||||
assertEquals(0, q.remainingCapacity());
|
||||
|
@ -376,28 +376,28 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
|
|||
public void realRun() throws InterruptedException {
|
||||
q.put(new Object());
|
||||
q.put(new Object());
|
||||
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS));
|
||||
assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
|
||||
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
|
||||
q.offer(new Object(), randomTimeout(), randomTimeUnit());
|
||||
shouldThrow();
|
||||
} catch (InterruptedException success) {}
|
||||
assertFalse(Thread.interrupted());
|
||||
|
||||
pleaseInterrupt.countDown();
|
||||
try {
|
||||
q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
|
||||
q.offer(new Object(), LONGER_DELAY_MS, MILLISECONDS);
|
||||
shouldThrow();
|
||||
} catch (InterruptedException success) {}
|
||||
assertFalse(Thread.interrupted());
|
||||
}});
|
||||
|
||||
await(pleaseInterrupt);
|
||||
assertThreadBlocks(t, Thread.State.TIMED_WAITING);
|
||||
if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
|
||||
t.interrupt();
|
||||
awaitTermination(t);
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
|
|||
}});
|
||||
|
||||
await(pleaseInterrupt);
|
||||
assertThreadBlocks(t, Thread.State.WAITING);
|
||||
if (randomBoolean()) assertThreadBlocks(t, Thread.State.WAITING);
|
||||
t.interrupt();
|
||||
awaitTermination(t);
|
||||
}
|
||||
|
@ -490,29 +490,26 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
|
|||
final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
|
||||
Thread t = newStartedThread(new CheckedRunnable() {
|
||||
public void realRun() throws InterruptedException {
|
||||
long startTime = System.nanoTime();
|
||||
for (int i = 0; i < SIZE; i++)
|
||||
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
|
||||
|
||||
Thread.currentThread().interrupt();
|
||||
try {
|
||||
q.poll(LONG_DELAY_MS, MILLISECONDS);
|
||||
q.poll(randomTimeout(), randomTimeUnit());
|
||||
shouldThrow();
|
||||
} catch (InterruptedException success) {}
|
||||
assertFalse(Thread.interrupted());
|
||||
|
||||
pleaseInterrupt.countDown();
|
||||
try {
|
||||
q.poll(LONG_DELAY_MS, MILLISECONDS);
|
||||
q.poll(LONGER_DELAY_MS, MILLISECONDS);
|
||||
shouldThrow();
|
||||
} catch (InterruptedException success) {}
|
||||
assertFalse(Thread.interrupted());
|
||||
|
||||
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
|
||||
}});
|
||||
|
||||
await(pleaseInterrupt);
|
||||
assertThreadBlocks(t, Thread.State.TIMED_WAITING);
|
||||
if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
|
||||
t.interrupt();
|
||||
awaitTermination(t);
|
||||
checkEmpty(q);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue