Class TaskHandlerImpl<T,V>
java.lang.Object
io.jmix.flowui.backgroundtask.impl.TaskHandlerImpl<T,V>
- All Implemented Interfaces:
BackgroundTaskHandler<V>
-
Constructor Summary
ConstructorsConstructorDescriptionTaskHandlerImpl(UIAccessor uiAccessor, TaskExecutor<T, V> taskExecutor, BackgroundTaskWatchDog backgroundTaskWatchDog, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, org.springframework.security.core.userdetails.UserDetails user, TimeSource timeSource) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancancel()Cancels task.final voidCancels without events for tasks.final voidexecute()Executes theBackgroundTask.final VJoin task thread to current
Caution! Call this method only from synchronous gui action;longfinal BackgroundTask<T,V> getTask()longfinal booleanisAlive()final booleanfinal booleanisDone()final voidkill()Cancels without events for tasks.protected voidonOwnerViewRemoved(com.vaadin.flow.component.Component ownerView) protected voidfinal voidCancels with timeout exceeded event.
-
Constructor Details
-
TaskHandlerImpl
public TaskHandlerImpl(UIAccessor uiAccessor, TaskExecutor<T, V> taskExecutor, BackgroundTaskWatchDog backgroundTaskWatchDog, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, org.springframework.security.core.userdetails.UserDetails user, TimeSource timeSource)
-
-
Method Details
-
onOwnerViewRemoved
protected void onOwnerViewRemoved(com.vaadin.flow.component.Component ownerView) -
execute
public final void execute()Description copied from interface:BackgroundTaskHandlerExecutes theBackgroundTask.
This method must be called only once for a handler instance.- Specified by:
executein interfaceBackgroundTaskHandler<T>
-
cancel
public final boolean cancel()Description copied from interface:BackgroundTaskHandlerCancels task.- Specified by:
cancelin interfaceBackgroundTaskHandler<T>- Returns:
trueif canceled,falseif the task was not started or is already stopped
-
removeViewDetachListener
protected void removeViewDetachListener() -
getResult
Join task thread to current
Caution! Call this method only from synchronous gui action;- Specified by:
getResultin interfaceBackgroundTaskHandler<T>- Returns:
- Task result
-
closeByTimeout
public final void closeByTimeout()Cancels without events for tasks. Need to executetimeoutExceeded()after this method. -
kill
public final void kill()Cancels without events for tasks. -
timeoutExceeded
public final void timeoutExceeded()Cancels with timeout exceeded event. -
isDone
public final boolean isDone()- Specified by:
isDonein interfaceBackgroundTaskHandler<T>- Returns:
trueif the task is completed
-
isCancelled
public final boolean isCancelled()- Specified by:
isCancelledin interfaceBackgroundTaskHandler<T>- Returns:
trueif the task has been canceled
-
isAlive
public final boolean isAlive()- Specified by:
isAlivein interfaceBackgroundTaskHandler<T>- Returns:
trueif the task is running
-
getTask
-
getStartTimeStamp
public long getStartTimeStamp() -
getTimeoutMs
public long getTimeoutMs()
-