Package io.jmix.flowui.backgroundtask
Interface TaskExecutor<T,V>
public interface TaskExecutor<T,V>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Cancels the execution and removes task formBackgroundTaskWatchDog
and fromBackgroundTaskManager
.Joins task thread to current and waits if task is not finished.getTask()
void
handleProgress
(T... changes) Handles changes from working thread.boolean
boolean
boolean
isDone()
void
setFinalizer
(Runnable finalizer) Sets done handler for clear resources.void
Executes background task.
-
Method Details
-
startExecution
void startExecution()Executes background task. -
cancelExecution
boolean cancelExecution()Cancels the execution and removes task formBackgroundTaskWatchDog
and fromBackgroundTaskManager
.- Returns:
true
if the canceling was successful
-
getResult
Joins task thread to current and waits if task is not finished.- Returns:
- result of the task
-
getTask
BackgroundTask<T,V> getTask()- Returns:
- the task
-
isCancelled
boolean isCancelled() -
isDone
boolean isDone() -
inProgress
boolean inProgress() -
setFinalizer
Sets done handler for clear resources.- Parameters:
finalizer
- Runnable handler
-
getFinalizer
Runnable getFinalizer() -
handleProgress
Handles changes from working thread.- Parameters:
changes
- Changes
-