Class MBeanOperationResultView.OperationBackgroundTask
- Enclosing class:
- MBeanOperationResultView
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.backgroundtask.BackgroundTask
BackgroundTask.ProgressListener<T,
V>, BackgroundTask.ProgressListenerAdapter<T, V> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OperationBackgroundTask
(long timeoutSeconds, View<?> view) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Provides exclusive access to this UI from outside a request handling thread when the task is completed.boolean
Provides exclusive access to this UI from outside a request handling thread if the taskBackgroundTask.run(TaskLifeCycle)
method raised an exception.boolean
Provides exclusive access to this UI from outside a request handling thread if the task timeout is exceeded.run
(TaskLifeCycle<Long> taskLifeCycle) Main method that performs a task.protected void
showResult
(String resultMessage) Methods inherited from class io.jmix.flowui.backgroundtask.BackgroundTask
addProgressListener, canceled, getOwnerView, getParams, getProgressListeners, getTimeoutMilliseconds, getTimeoutSeconds, progress, removeProgressListener
-
Constructor Details
-
OperationBackgroundTask
-
-
Method Details
-
run
Description copied from class:BackgroundTask
Main method that performs a task.
Called by the execution environment in a separate working thread.
Implementation of this method should support interruption:- In long loops check
TaskLifeCycle.isInterrupted()
and return if it is true - Don't swallow
InterruptedException
- return from the method or don't catch it at all
- Specified by:
run
in classBackgroundTask<Long,
Object> - Parameters:
taskLifeCycle
- lifecycle object that allows the main method to interact with the execution environment- Returns:
- task result
- In long loops check
-
done
Description copied from class:BackgroundTask
Provides exclusive access to this UI from outside a request handling thread when the task is completed.Please note that the command might be invoked on a different thread or later on the current thread, which means that custom thread locals might not have the expected values when the command is executed.
UI.getCurrent()
,VaadinSession.getCurrent()
andVaadinService.getCurrent()
are set according to this UI before executing the command. Other standard CurrentInstance values such asVaadinService.getCurrentRequest()
andVaadinService.getCurrentResponse()
will not be defined.- Overrides:
done
in classBackgroundTask<Long,
Object> - Parameters:
res
- result of execution returned byBackgroundTask.run(TaskLifeCycle)
method- See Also:
-
UI.access(Command)
-
handleException
Description copied from class:BackgroundTask
Provides exclusive access to this UI from outside a request handling thread if the taskBackgroundTask.run(TaskLifeCycle)
method raised an exception.Please note that the command might be invoked on a different thread or later on the current thread, which means that custom thread locals might not have the expected values when the command is executed.
UI.getCurrent()
,VaadinSession.getCurrent()
andVaadinService.getCurrent()
are set according to this UI before executing the command. Other standard CurrentInstance values such asVaadinService.getCurrentRequest()
andVaadinService.getCurrentResponse()
will not be defined.- Overrides:
handleException
in classBackgroundTask<Long,
Object> - Parameters:
ex
- exception- Returns:
- true if this method implementation actually handles the exception. Used for chaining handlers.
- See Also:
-
UI.access(Command)
-
handleTimeoutException
public boolean handleTimeoutException()Description copied from class:BackgroundTask
Provides exclusive access to this UI from outside a request handling thread if the task timeout is exceeded.Please note that the command might be invoked on a different thread or later on the current thread, which means that custom thread locals might not have the expected values when the command is executed.
UI.getCurrent()
,VaadinSession.getCurrent()
andVaadinService.getCurrent()
are set according to this UI before executing the command. Other standard CurrentInstance values such asVaadinService.getCurrentRequest()
andVaadinService.getCurrentResponse()
will not be defined.- Overrides:
handleTimeoutException
in classBackgroundTask<Long,
Object> - Returns:
- true if this method implementation actually handles this event. Used for chaining handlers.
- See Also:
-
UI.access(Command)
-
showResult
-