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

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.66 by jsr166, Mon Oct 5 21:54:33 2015 UTC vs.
Revision 1.70 by jsr166, Tue Oct 6 05:12:16 2015 UTC

# Line 48 | Line 48 | public class ScheduledExecutorTest exten
48              final Runnable task = new CheckedRunnable() {
49                  public void realRun() { done.countDown(); }};
50              p.execute(task);
51 <            assertTrue(done.await(SMALL_DELAY_MS, MILLISECONDS));
51 >            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
52          }
53      }
54  
# Line 156 | Line 156 | public class ScheduledExecutorTest exten
156                      public void realRun() { done.countDown(); }};
157                  ScheduledFuture h =
158                      p.scheduleAtFixedRate(task, 0, delay, MILLISECONDS);
159 <                done.await();
159 >                await(done);
160                  h.cancel(true);
161                  double normalizedTime =
162                      (double) millisElapsedSince(startTime) / delay;
# Line 182 | Line 182 | public class ScheduledExecutorTest exten
182                      public void realRun() { done.countDown(); }};
183                  ScheduledFuture h =
184                      p.scheduleWithFixedDelay(task, 0, delay, MILLISECONDS);
185 <                done.await();
185 >                await(done);
186                  h.cancel(true);
187                  double normalizedTime =
188                      (double) millisElapsedSince(startTime) / delay;
# Line 315 | Line 315 | public class ScheduledExecutorTest exten
315                  public void realRun() throws InterruptedException {
316                      threadStarted.countDown();
317                      assertEquals(1, p.getActiveCount());
318 <                    done.await();
318 >                    await(done);
319                  }});
320 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
320 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
321              assertEquals(1, p.getActiveCount());
322              done.countDown();
323          }
# Line 379 | Line 379 | public class ScheduledExecutorTest exten
379                  p.execute(new CheckedRunnable() {
380                      public void realRun() throws InterruptedException {
381                          threadsStarted.countDown();
382 <                        done.await();
382 >                        await(done);
383                          assertEquals(THREADS, p.getLargestPoolSize());
384                      }});
385 <            assertTrue(threadsStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
385 >            assertTrue(threadsStarted.await(LONG_DELAY_MS, MILLISECONDS));
386              assertEquals(THREADS, p.getLargestPoolSize());
387              done.countDown();
388          }
# Line 403 | Line 403 | public class ScheduledExecutorTest exten
403                  public void realRun() throws InterruptedException {
404                      threadStarted.countDown();
405                      assertEquals(1, p.getPoolSize());
406 <                    done.await();
406 >                    await(done);
407                  }});
408 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
408 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
409              assertEquals(1, p.getPoolSize());
410              done.countDown();
411          }
# Line 426 | Line 426 | public class ScheduledExecutorTest exten
426              p.execute(new CheckedRunnable() {
427                  public void realRun() throws InterruptedException {
428                      threadStarted.countDown();
429 <                    done.await();
429 >                    await(done);
430                  }});
431              assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
432              assertEquals(1, p.getTaskCount());
# Line 437 | Line 437 | public class ScheduledExecutorTest exten
437                      public void realRun() throws InterruptedException {
438                          threadStarted.countDown();
439                          assertEquals(1 + TASKS, p.getTaskCount());
440 <                        done.await();
440 >                        await(done);
441                      }});
442              }
443              assertEquals(1 + TASKS, p.getTaskCount());
# Line 512 | Line 512 | public class ScheduledExecutorTest exten
512                  public void realRun() throws InterruptedException {
513                      assertFalse(p.isTerminated());
514                      threadStarted.countDown();
515 <                    done.await();
515 >                    await(done);
516                  }});
517 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
517 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
518              assertFalse(p.isTerminating());
519              done.countDown();
520              try { p.shutdown(); } catch (SecurityException ok) { return; }
# Line 536 | Line 536 | public class ScheduledExecutorTest exten
536                  public void realRun() throws InterruptedException {
537                      assertFalse(p.isTerminating());
538                      threadStarted.countDown();
539 <                    done.await();
539 >                    await(done);
540                  }});
541 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
541 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
542              assertFalse(p.isTerminating());
543              done.countDown();
544              try { p.shutdown(); } catch (SecurityException ok) { return; }
# Line 561 | Line 561 | public class ScheduledExecutorTest exten
561                  Runnable r = new CheckedRunnable() {
562                      public void realRun() throws InterruptedException {
563                          threadStarted.countDown();
564 <                        done.await();
564 >                        await(done);
565                      }};
566                  tasks[i] = p.schedule(r, 1, MILLISECONDS);
567              }
568 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
568 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
569              BlockingQueue<Runnable> q = p.getQueue();
570              assertTrue(q.contains(tasks[tasks.length - 1]));
571              assertFalse(q.contains(tasks[0]));
# Line 586 | Line 586 | public class ScheduledExecutorTest exten
586                  Runnable r = new CheckedRunnable() {
587                      public void realRun() throws InterruptedException {
588                          threadStarted.countDown();
589 <                        done.await();
589 >                        await(done);
590                      }};
591                  tasks[i] = p.schedule(r, 1, MILLISECONDS);
592              }
593 <            assertTrue(threadStarted.await(MEDIUM_DELAY_MS, MILLISECONDS));
593 >            assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS));
594              BlockingQueue<Runnable> q = p.getQueue();
595              assertFalse(p.remove((Runnable)tasks[0]));
596              assertTrue(q.contains((Runnable)tasks[4]));
# Line 1141 | Line 1141 | public class ScheduledExecutorTest exten
1141              List<Callable<String>> l = new ArrayList<Callable<String>>();
1142              l.add(new NPETask());
1143              List<Future<String>> futures =
1144 <                e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1144 >                e.invokeAll(l, LONG_DELAY_MS, MILLISECONDS);
1145              assertEquals(1, futures.size());
1146              try {
1147                  futures.get(0).get();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines