public interface UpdateTaskExecutor
scheduled to them
previously. That is if scheduling task1 happen-before
scheduling task2, task1 may be silently discarded and never
executed.
For example see the following code:
void testExecute() {
UpdateTaskExecutor executor = ...;
executor.execute(() -> System.out.print("1"));
executor.execute(() -> System.out.print("2"));
executor.execute(() -> System.out.print("3"));
}
The method testExecute may either print "3" or "23" or "123",
depending on the implementation and other external conditions.
The UpdateTaskExecutor is particularly good when reporting progress
to be displayed. Since in this case previously reported progresses would
have been overwritten anyway, so it is safe to discard old tasks.
Note that although not strictly required to execute tasks in the order they
were scheduled but in most cases an UpdateTaskExecutor works well
only when executes task in order.
GenericUpdateTaskExecutor| Modifier and Type | Method and Description |
|---|---|
void |
execute(Runnable task)
Submits a task which is to be executed in the future.
|
void execute(Runnable task)
execute call.task - the task to be executed. This argument cannot be
null.