public interface BackgroundTask
BackgroundTaskExecutor.
The task is to be executed in the context of an
access token
(BackgroundTaskExecutor automatically does so). The task will have
a chance to report its progress (or anything else) on the UI thread of the associated
UI framework. This reports are also executed in the
context of the same access token in which the task is being executed.
BackgroundTask is completely
implementation dependent and the submitter of the task must consider it when
submitting it.
BackgroundTask is not required to be
synchronization transparent. The execute method of this class
should not be executed on the EDT as it can be lengthy.BackgroundTaskExecutor| Modifier and Type | Method and Description |
|---|---|
void |
execute(CancellationToken cancelToken,
UiReporter reporter)
Executes the implementation dependent task of this
BackgroundTask. |
void execute(CancellationToken cancelToken, UiReporter reporter) throws Exception
BackgroundTask. This method may possibly be lengthy and in
general must not be executed on the EDT (so that it may not prevent
events to processed).cancelToken - the CancellationToken which can be checked
periodically by this task to detect cancellation requests. This
argument cannot be null.reporter - the object which can be used to report the progress of
the execution of this task (or possibly anything else). This argument
cannot be null.OperationCanceledException - thrown if
cancellation has been requested and this method did not complete due to
this requestException - thrown if there was an error while executing this
task. Note that regardless, you should only throw truly unexpected
exceptions because you probably need to report such exceptions to the
user.