Package ubic.gemma.core.job
Interface SubmittedTask
-
- Type Parameters:
T
- TaskResult (or subclass) representing type of result of submitted task.
- All Known Implementing Classes:
SubmittedTaskAbstract
,SubmittedTaskLocal
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SubmittedTask.Status
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEmailAlert()
Add email notification of task completion.Date
getFinishTime()
String
getLastProgressUpdates()
Queue<String>
getProgressUpdates()
Returns queue of log statements from the running task.TaskResult
getResult()
Get the result of the task.Date
getStartTime()
SubmittedTask.Status
getStatus()
Date
getSubmissionTime()
TaskCommand
getTaskCommand()
String
getTaskId()
boolean
isDone()
boolean
isEmailAlert()
boolean
isRunningRemotely()
void
requestCancellation()
Send cancellation request.
-
-
-
Method Detail
-
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
SubmittedTask.Status getStatus()
- Returns:
- current status of the task
-
isDone
boolean isDone()
- Returns:
- true if task has completed or failed
-
getResult
TaskResult getResult() throws ExecutionException, InterruptedException
Get the result of the task. The call blocks until the result is retrieved.- Returns:
- result of produced by the task.
- Throws:
ExecutionException
- execution exceptionInterruptedException
- 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)
-
-