8358151: Harden JSR166 Test case testShutdownNow_delayedTasks
Reviewed-by: alanb, shade
This commit is contained in:
parent
612f2c0c0b
commit
83cb0c6de5
@ -546,11 +546,13 @@ public class ForkJoinPool20Test extends JSR166TestCase {
|
||||
public void testShutdownNow_delayedTasks() throws InterruptedException {
|
||||
final ForkJoinPool p = new ForkJoinPool(2);
|
||||
List<ScheduledFuture<?>> tasks = new ArrayList<>();
|
||||
final int DELAY = 100;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Runnable r = new NoOpRunnable();
|
||||
tasks.add(p.schedule(r, 9, SECONDS));
|
||||
tasks.add(p.scheduleAtFixedRate(r, 9, 9, SECONDS));
|
||||
tasks.add(p.scheduleWithFixedDelay(r, 9, 9, SECONDS));
|
||||
tasks.add(p.schedule(r, DELAY, SECONDS));
|
||||
tasks.add(p.scheduleAtFixedRate(r, DELAY, DELAY, SECONDS));
|
||||
tasks.add(p.scheduleWithFixedDelay(r, DELAY, DELAY, SECONDS));
|
||||
}
|
||||
p.shutdownNow();
|
||||
assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
|
||||
|
@ -741,11 +741,13 @@ public class ScheduledExecutorSubclassTest extends JSR166TestCase {
|
||||
public void testShutdownNow_delayedTasks() throws InterruptedException {
|
||||
final CustomExecutor p = new CustomExecutor(1);
|
||||
List<ScheduledFuture<?>> tasks = new ArrayList<>();
|
||||
final int DELAY = 100;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Runnable r = new NoOpRunnable();
|
||||
tasks.add(p.schedule(r, 9, SECONDS));
|
||||
tasks.add(p.scheduleAtFixedRate(r, 9, 9, SECONDS));
|
||||
tasks.add(p.scheduleWithFixedDelay(r, 9, 9, SECONDS));
|
||||
tasks.add(p.schedule(r, DELAY, SECONDS));
|
||||
tasks.add(p.scheduleAtFixedRate(r, DELAY, DELAY, SECONDS));
|
||||
tasks.add(p.scheduleWithFixedDelay(r, DELAY, DELAY, SECONDS));
|
||||
}
|
||||
if (testImplementationDetails)
|
||||
assertEquals(new HashSet<Object>(tasks), new HashSet<Object>(p.getQueue()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user