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 |
|
|
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; |
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; |
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 |
|
} |
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 |
|
} |
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 |
|
} |
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()); |
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()); |
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; } |
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; } |
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])); |
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])); |
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(); |