Package io.jmix.flowui.backgroundtask
Class BackgroundTaskManager
java.lang.Object
io.jmix.flowui.backgroundtask.BackgroundTaskManager
Manages background tasks within a Vaadin application session, allowing tasks to be added, removed,
or all tasks to be canceled. Each task is represented by a
Future object, and the class provides
utilities to interact with the current Vaadin session to ensure proper thread synchronization and instance management.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds task to task set.voidInterrupts all tasks.static BackgroundTaskManagerstatic booleanisBound()voidremoveTask(Future<?> task) Stops manage of stopped task.
-
Constructor Details
-
BackgroundTaskManager
public BackgroundTaskManager()
-
-
Method Details
-
addTask
Adds task to task set.- Parameters:
task- Task
-
removeTask
Stops manage of stopped task.- Parameters:
task- Task
-
cleanupTasks
public void cleanupTasks()Interrupts all tasks. -
getInstance
- Returns:
- background task manager instance corresponding current
VaadinSession. Can be invoked anywhere in application code. - Throws:
IllegalStateException- if no background task manager instance is bound to the currentVaadinSession
-
isBound
public static boolean isBound()- Returns:
trueif anBackgroundTaskManagerinstance is currently bound and can be safely obtained bygetInstance()
-