All Known Implementing Classes:
AbstractTask

public interface Task
A Task is an executable entity that is run by the gateway. It is a long running operation that can be paused, canceled, and monitored. A Task instance is created through a TaskType, in conjunction with task settings. It is configured in the gateway web UI, according to the TaskType.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    If a task can be suspended and resumed, this is an arbitrary state that will be used to resume.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(long timeoutMS)
    When called, the task should stop as quickly as possible.
    Returns a List of all the exceptions that occurred when running a task.
     
    void
     
    void
    run(TaskContext context)
    Executes the task.
    suspend(long timeoutMS)
    When called, the task should stop as quickly as possible.
  • Method Details

    • getId

      UUID getId()
    • run

      void run(TaskContext context) throws Exception
      Executes the task. This function should block until completion. If there is a problem executing the task, an exception should be thrown. It is important to note that while this function should block, the task must expect that at some point, suspend or cancel may be called.
      Throws:
      Exception
    • suspend

      When called, the task should stop as quickly as possible. If the task is able to resume, it should return a state that will be provided to it when restarted. If this function returns an empty value, it will not be resumed. If appropriate, the call should try to implement the timeout restriction passed in. A timeout of 0 means "no timeout".
      Throws:
      TimeoutException
      InterruptedException
    • resume

      void resume(Task.TaskStateModel state)
    • cancel

      void cancel(long timeoutMS) throws TimeoutException, InterruptedException
      When called, the task should stop as quickly as possible. If appropriate, the call should try to implement the timeout restriction passed in. A timeout of 0 means "no timeout".
      Throws:
      TimeoutException
      InterruptedException
    • getErrors

      List<Throwable> getErrors()
      Returns a List of all the exceptions that occurred when running a task. If no exceptions occurred, an empty List is returned.