Interface BackgroundTask.ProgressListener<T,V>

Type Parameters:
T - progress measurement unit
V - result type
All Known Implementing Classes:
BackgroundTask.ProgressListenerAdapter
Enclosing class:
BackgroundTask<T,V>

public static interface BackgroundTask.ProgressListener<T,V>
Listener of the task life cycle events, complementary to the tasks own methods: BackgroundTask.progress(List), BackgroundTask.done(Object), BackgroundTask.canceled().
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Provides exclusive access to this UI from outside a request handling thread when the task is canceled by BackgroundTaskHandler.cancel() invocation.
    void
    onDone(V result)
    Provides exclusive access to this UI from outside a request handling thread when the task is completed.
    void
    onProgress(List<T> changes)
    Provides exclusive access to this UI from outside a request handling thread on progress change.
  • Method Details

    • onProgress

      void onProgress(List<T> changes)
      Provides exclusive access to this UI from outside a request handling thread on progress change.

      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() and VaadinService.getCurrent() are set according to this UI before executing the command. Other standard CurrentInstance values such as VaadinService.getCurrentRequest() and VaadinService.getCurrentResponse() will not be defined.

      Parameters:
      changes - list of changes since previous invocation
      See Also:
      • UI.access(Command)
    • onDone

      void onDone(V result)
      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() and VaadinService.getCurrent() are set according to this UI before executing the command. Other standard CurrentInstance values such as VaadinService.getCurrentRequest() and VaadinService.getCurrentResponse() will not be defined.

      Parameters:
      result - result of execution returned by BackgroundTask.run(TaskLifeCycle) method
      See Also:
      • UI.access(Command)
    • onCancel

      void onCancel()
      Provides exclusive access to this UI from outside a request handling thread when the task is canceled by BackgroundTaskHandler.cancel() invocation.

      This method is not called in case of timeout expiration or owner view closing.

      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() and VaadinService.getCurrent() are set according to this UI before executing the command. Other standard CurrentInstance values such as VaadinService.getCurrentRequest() and VaadinService.getCurrentResponse() will not be defined.

      See Also:
      • UI.access(Command)