Interface ILspTaskExecutor
public interface ILspTaskExecutor
Interface for a class that can schedule and execute tasks. Tasks are
submitted in the form of
Runnable objects and are typically
executed in an asynchronous fashion. Tasks can be monitored by registering
a listener.- Since:
- 2012.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Attempts to cancel all currently pending tasks and blocks until the task queue is empty.voidaddTaskListener(ILspTaskExecutorListener aTaskExecutorListener) Adds a task listener to this task executor.voiddestroy()Callsabort()and renders the task executor invalid to use.execute(TLspTaskExecutorRunnable aTaskExecutorRunnable) Schedules the suppliedRunnablefor execution.voidflush()Blocks until all currently pending tasks have finished.voidremoveTaskListener(ILspTaskExecutorListener aTaskExecutorListener) Removes a task listener from this task executor.
-
Method Details
-
execute
Schedules the suppliedRunnablefor execution. The actual execution may take place at some unspecified point in the future. This method therefore returns aFuturewhich can be used to query the progress of the task. A return value ofnullindicates that the task was already executed when this method returned.- Parameters:
aTaskExecutorRunnable- the task to be executed- Returns:
- a
Futurefor following up on the task
-
flush
void flush()Blocks until all currently pending tasks have finished. -
abort
void abort()Attempts to cancel all currently pending tasks and blocks until the task queue is empty. -
destroy
void destroy()Callsabort()and renders the task executor invalid to use. -
addTaskListener
Adds a task listener to this task executor. The task listener will be notified of any changes in tasks.- Parameters:
aTaskExecutorListener- a task executor listener that will be notified of task updates
-
removeTaskListener
Removes a task listener from this task executor. The task listener will no longer be notified of any changes in tasks.- Parameters:
aTaskExecutorListener- a task executor listener that will no longer be notified of task updates
-