Home | History | Annotate | Download | only in jsr166

Lines Matching defs:TASKS

210      * scheduleAtFixedRate executes series of tasks at given rate.
239 * scheduleWithFixedDelay executes series of tasks with given period.
414 * when tasks complete
499 * getTaskCount increases, but doesn't overestimate, when tasks
503 final int TASKS = 3;
518 for (int i = 0; i < TASKS; i++) {
523 assertEquals(1 + TASKS, p.getTaskCount());
527 assertEquals(1 + TASKS, p.getTaskCount());
530 assertEquals(1 + TASKS, p.getTaskCount());
531 assertEquals(1 + TASKS, p.getCompletedTaskCount());
632 * getQueue returns the work queue, which contains queued tasks
639 ScheduledFuture[] tasks = new ScheduledFuture[5];
640 for (int i = 0; i < tasks.length; i++) {
646 tasks[i] = p.schedule(r, 1, MILLISECONDS);
650 assertTrue(q.contains(tasks[tasks.length - 1]));
651 assertFalse(q.contains(tasks[0]));
662 ScheduledFuture[] tasks = new ScheduledFuture[5];
664 for (int i = 0; i < tasks.length; i++) {
670 tasks[i] = p.schedule(r, 1, MILLISECONDS);
674 assertFalse(p.remove((Runnable)tasks[0]));
675 assertTrue(q.contains((Runnable)tasks[4]));
676 assertTrue(q.contains((Runnable)tasks[3]));
677 assertTrue(p.remove((Runnable)tasks[4]));
678 assertFalse(p.remove((Runnable)tasks[4]));
679 assertFalse(q.contains((Runnable)tasks[4]));
680 assertTrue(q.contains((Runnable)tasks[3]));
681 assertTrue(p.remove((Runnable)tasks[3]));
682 assertFalse(q.contains((Runnable)tasks[3]));
687 * purge removes cancelled tasks from the queue
690 final ScheduledFuture[] tasks = new ScheduledFuture[5];
692 for (ScheduledFuture task : tasks)
696 for (int i = 0; i < tasks.length; i++)
697 tasks[i] = p.schedule(new SmallPossiblyInterruptedRunnable(),
699 int max = tasks.length;
700 if (tasks[4].cancel(true)) --max;
701 if (tasks[3].cancel(true)) --max;
711 fail("Purge failed to remove cancelled tasks");
716 * shutdownNow returns a list containing tasks that were not run,
717 * and those tasks are drained from the queue
753 * shutdownNow returns a list containing tasks that were not run,
754 * and those tasks are drained from the queue
758 List<ScheduledFuture> tasks = new ArrayList<>();
761 tasks.add(p.schedule(r, 9, SECONDS));
762 tasks.add(p.scheduleAtFixedRate(r, 9, 9, SECONDS));
763 tasks.add(p.scheduleWithFixedDelay(r, 9, 9, SECONDS));
766 assertEquals(new HashSet(tasks), new HashSet(p.getQueue()));
776 assertEquals(new HashSet(tasks), new HashSet(queuedTasks));
777 assertEquals(tasks.size(), queuedTasks.size());
778 for (ScheduledFuture task : tasks) {
788 * By default, periodic tasks are cancelled at shutdown.
789 * By default, delayed tasks keep running after shutdown.
1051 * invokeAll(c) returns results of all completed tasks
1236 * timed invokeAll(c) returns results of all completed tasks
1253 * timed invokeAll(c) cancels tasks not completed by timeout
1265 List<Callable<String>> tasks = new ArrayList<>();
1266 tasks.add(new StringTask("0"));
1267 tasks.add(waiter);
1268 tasks.add(new StringTask("2"));
1271 p.invokeAll(tasks, timeout, MILLISECONDS);
1272 assertEquals(tasks.size(), futures.size());