Class AsyncTaskStatusChangeEvent<R>

java.lang.Object
java.util.EventObject
org.dellroad.stuff.vaadin24.util.AsyncTaskStatusChangeEvent<R>
Type Parameters:
R - task result type
All Implemented Interfaces:
Serializable

public class AsyncTaskStatusChangeEvent<R> extends EventObject
Event type emitted by an AsyncTaskManager when an AsyncTask changes status.
See Also:
  • Field Details

    • STARTED

      public static final int STARTED
      Status value indicating that a new asynchronous task has started.
      See Also:
    • COMPLETED

      public static final int COMPLETED
      Status value indicating that an asynchronous task has completed successfully.
      See Also:
    • CANCELED

      public static final int CANCELED
      Status value indicating that an asynchronous task was cancelTask()'ed (or canceled itself by throwing InterruptedException).
      See Also:
    • FAILED

      public static final int FAILED
      Status value indicating that an asynchronous task failed (i.e., threw an exception).
      See Also:
  • Constructor Details

  • Method Details

    • getTaskId

      public long getTaskId()
      Get the ID of the associated asynchronous task.
      Returns:
      task ID
    • getStatus

      public int getStatus()
      Get the new status of the associated asynchronous task: one of STARTED, COMPLETED, CANCELED, or FAILED.
      Returns:
      status
    • getSource

      public AsyncTaskManager<R> getSource()
      Get the AsyncTaskManager that originated this event.
      Overrides:
      getSource in class EventObject
      Returns:
      event originator
    • getResult

      public R getResult()
      Get the result from the successfully completed associated asynchronous task.

      This method returns null except when the status is COMPLETED, in which case it returns the result of the task.

      Returns:
      task result, or null if task has not completed successfully
    • getException

      public Throwable getException()
      Get the exception thrown by the associated asynchronous task that failed or was canceled.

      This method returns null except when the status is FAILED or CANCELED, in which case it returns the exception thrown. In the case of CANCELED, this will always be an InterruptedException.

      Returns:
      error thrown, or null if task has not yet finished or completed successfully