Lines Matching refs:task

29  * An implementation of a task aggregator that executes tasks in the order that they are expected
32 * The task will be scheduled to run when its corresponding key becomes the first expected key
35 * If on {@link #execute(Object, Runnable)} the key is not expected, the task will be executed
42 * <li>Execute task <b>2</b> for key <b>B</b>. The first expected key is <b>A</b>,
43 * which has no task associated with it, so we store task <b>2</b>. </li>
44 * <li>Execute task <b>4</b> for key <b>Z</b>. We store task <b>4</b>. </li>
45 * <li>Execute task <b>1</b> for key <b>A</b>. We run task <b>1</b> because its key <b>A</b> is
48 * stored task <b>2</b> for that key. We run task <b>2</b> and remove key <b>B</b>. </li>
49 * <li>Key <b>C</b> is now the first expected key, but it has no task,
52 * happen if a task comes in for key <b>C</b> or if forget is called on key <b>C</b>.</li>
68 * unbounded. This may happen, for instance, if the top priority key is never given a task to
90 * @param key the key to expect a task for. Use the same key when setting the task later
119 * Remove a previously declared key that we no longer expect to execute a task for. This
154 * Attempt to execute a task corresponding to a previously declared key. If the key is the
155 * first expected key, the task will be executed immediately. Otherwise, the task is stored
156 * until its key becomes the first expected key. Execution of a task results in the removal
160 * If the key is not expected, the task will be executed immediately as an edge case.
163 * @param task the task to execute or store, depending on its corresponding key.
165 public void execute(final T key, final Runnable task) {
169 if (value == null || task == null) {
170 if (task != null) {
171 task.run();
176 value.task = task;
188 * stopping when it finds that the first expected key has not yet been assigned a task.
203 if (value.task == null) {
213 value.task.run();
285 * expected, it would either have to be forgotten with {@link #forget(Object)} or a task
296 * Holds the callback and task for when a key later becomes the first expected key.
301 Runnable task;
303 Value(final Callback<T> callback, final Runnable task) {
305 this.task = task;
310 return String.valueOf(task);