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 TypeMethodDescriptionvoid
abort()
Attempts to cancel all currently pending tasks and blocks until the task queue is empty.void
addTaskListener
(ILspTaskExecutorListener aTaskExecutorListener) Adds a task listener to this task executor.void
destroy()
Callsabort()
and renders the task executor invalid to use.execute
(TLspTaskExecutorRunnable aTaskExecutorRunnable) Schedules the suppliedRunnable
for execution.void
flush()
Blocks until all currently pending tasks have finished.void
removeTaskListener
(ILspTaskExecutorListener aTaskExecutorListener) Removes a task listener from this task executor.
-
Method Details
-
execute
Schedules the suppliedRunnable
for execution. The actual execution may take place at some unspecified point in the future. This method therefore returns aFuture
which can be used to query the progress of the task. A return value ofnull
indicates that the task was already executed when this method returned.- Parameters:
aTaskExecutorRunnable
- the task to be executed- Returns:
- a
Future
for 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
-