Interface Task
- 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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceIf a task can be suspended and resumed, this is an arbitrary state that will be used to resume. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(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.getId()voidresume(Task.TaskStateModel state) voidrun(TaskContext context) Executes the task.suspend(long timeoutMS) When called, the task should stop as quickly as possible.
-
Method Details
-
getId
UUID getId() -
run
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:
TimeoutExceptionInterruptedException
-
resume
-
cancel
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:
TimeoutExceptionInterruptedException
-
getErrors
Returns a List of all the exceptions that occurred when running a task. If no exceptions occurred, an empty List is returned.
-