Class TaskHandlerImpl<T,V>

java.lang.Object
io.jmix.flowui.backgroundtask.impl.TaskHandlerImpl<T,V>
All Implemented Interfaces:
BackgroundTaskHandler<V>

public class TaskHandlerImpl<T,V> extends Object implements BackgroundTaskHandler<V>
  • 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: BackgroundTaskHandler
      Executes the BackgroundTask.
      This method must be called only once for a handler instance.
      Specified by:
      execute in interface BackgroundTaskHandler<T>
    • cancel

      public final boolean cancel()
      Description copied from interface: BackgroundTaskHandler
      Cancels task.
      Specified by:
      cancel in interface BackgroundTaskHandler<T>
      Returns:
      true if canceled, false if the task was not started or is already stopped
    • removeViewDetachListener

      protected void removeViewDetachListener()
    • getResult

      @Nullable public final V getResult()
      Join task thread to current
      Caution! Call this method only from synchronous gui action;
      Specified by:
      getResult in interface BackgroundTaskHandler<T>
      Returns:
      Task result
    • closeByTimeout

      public final void closeByTimeout()
      Cancels without events for tasks. Need to execute timeoutExceeded() 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:
      isDone in interface BackgroundTaskHandler<T>
      Returns:
      true if the task is completed
    • isCancelled

      public final boolean isCancelled()
      Specified by:
      isCancelled in interface BackgroundTaskHandler<T>
      Returns:
      true if the task has been canceled
    • isAlive

      public final boolean isAlive()
      Specified by:
      isAlive in interface BackgroundTaskHandler<T>
      Returns:
      true if the task is running
    • getTask

      public final BackgroundTask<T,V> getTask()
    • getStartTimeStamp

      public long getStartTimeStamp()
    • getTimeoutMs

      public long getTimeoutMs()