Package io.jmix.ui.executor.impl
Class TaskHandlerImpl<T,V>
java.lang.Object
io.jmix.ui.executor.impl.TaskHandlerImpl<T,V>
- All Implemented Interfaces:
BackgroundTaskHandler<V>
-
Constructor Summary
ConstructorsConstructorDescriptionTaskHandlerImpl(UIAccessor uiAccessor, TaskExecutor<T, V> taskExecutor, WatchDog watchDog, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, org.springframework.security.core.userdetails.UserDetails user, TimeSource timeSource) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancancel()Cancel task.final voidCancel without events for tasks.final voidexecute()Execute 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()Cancel without events for tasksprotected voidownerWindowRemoved(FrameOwner frameOwner) protected voidfinal voidCancel with timeout exceeded event
-
Constructor Details
-
TaskHandlerImpl
public TaskHandlerImpl(UIAccessor uiAccessor, TaskExecutor<T, V> taskExecutor, WatchDog watchDog, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, org.springframework.security.core.userdetails.UserDetails user, TimeSource timeSource)
-
-
Method Details
-
ownerWindowRemoved
-
execute
public final void execute()Description copied from interface:BackgroundTaskHandlerExecute 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:BackgroundTaskHandlerCancel task.- Specified by:
cancelin interfaceBackgroundTaskHandler<T>- Returns:
- true if canceled, false if the task was not started or is already stopped
-
removeAfterDetachListener
protected void removeAfterDetachListener() -
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()Cancel without events for tasks. Need to execute #timeoutExceeded after this method -
kill
public final void kill()Cancel without events for tasks -
timeoutExceeded
public final void timeoutExceeded()Cancel with timeout exceeded event -
isDone
public final boolean isDone()- Specified by:
isDonein interfaceBackgroundTaskHandler<T>- Returns:
- true if the task is completed
-
isCancelled
public final boolean isCancelled()- Specified by:
isCancelledin interfaceBackgroundTaskHandler<T>- Returns:
- true if the task has been canceled
-
isAlive
public final boolean isAlive()- Specified by:
isAlivein interfaceBackgroundTaskHandler<T>- Returns:
- true if the task is running
-
getTask
-
getStartTimeStamp
public long getStartTimeStamp() -
getTimeoutMs
public long getTimeoutMs()
-