Interface SubmittedTask

Type Parameters:
T - TaskResult (or subclass) representing type of result of submitted task.

public interface SubmittedTask
Obtained from the TaskRunningService, can be used to monitor status. Interface representing handler on a task submitted to TaskRunningService. It provides access to task status, task progress updates and task result. It allows to request task cancellation, add email notification of task completion.
Author:
anton
  • Method Details

    • getTaskId

      String getTaskId()
    • getTaskCommand

      TaskCommand getTaskCommand()
    • getProgressUpdates

      Queue<String> getProgressUpdates()
      Returns queue of log statements from the running task.
      Returns:
      Queue of log statements from the running task.
    • getLastProgressUpdates

      String getLastProgressUpdates()
    • getSubmissionTime

      Date getSubmissionTime()
      Returns:
      timestamp of task submission to TaskRunningService.
    • getStartTime

      Date getStartTime()
      Returns:
      time when task started executing.
    • getFinishTime

      Date getFinishTime()
      Returns:
      time when tasks completed or failed.
    • getStatus

      Returns:
      current status of the task
    • isDone

      boolean isDone()
      Returns:
      true if task has completed or failed
    • getResult

      Get the result of the task. The call blocks until the result is retrieved.
      Returns:
      result of produced by the task.
      Throws:
      ExecutionException - execution exception
      InterruptedException - interrupted exception
    • requestCancellation

      void requestCancellation()
      Send cancellation request. It's not guaranteed that this will cancel the task but it will request task cancellation. Client can check task's status at some later point to verify that task got cancelled.
    • addEmailAlert

      void addEmailAlert()
      Add email notification of task completion. User who submitted the task will receive an email.
    • isEmailAlert

      boolean isEmailAlert()
      Returns:
      true if email notification of task completion will be sent to the user.
    • isRunningRemotely

      boolean isRunningRemotely()
      Returns:
      true if the task is running remotely (inside another JVM)