V
- the response type of the taskpublic abstract class Task<V> extends Object implements Comparable<Task>
Job
.Modifier and Type | Class and Description |
---|---|
static class |
Task.TaskStat
Metrics and stats to track current task.
|
Constructor and Description |
---|
Task(Job job,
int taskId)
constructs Task.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Task o) |
boolean |
equals(Object obj) |
void |
execute(BlockWorkerClient client,
WorkerInfo workerInfo)
run the task and set the response future.
|
Job |
getJob()
Get the job this task belongs to.
|
WorkerInfo |
getMyRunningWorker()
Get the worker info this task runs on.
|
int |
getPriority() |
com.google.common.util.concurrent.ListenableFuture<V> |
getResponseFuture() |
int |
getTaskId()
Get task id.
|
Task.TaskStat |
getTaskStat() |
int |
hashCode() |
protected abstract com.google.common.util.concurrent.ListenableFuture<V> |
run(BlockWorkerClient client)
run the task.
|
void |
setJob(Job job)
Set the job.
|
void |
setMyRunningWorker(WorkerInfo workerInfo)
Set the worker info this task runs on.
|
void |
setPriority(int priority)
Set priority.
|
String |
toString() |
protected Job mMyJob
public Task(Job job, int taskId)
job
- taskId
- protected abstract com.google.common.util.concurrent.ListenableFuture<V> run(BlockWorkerClient client)
public WorkerInfo getMyRunningWorker()
public void setMyRunningWorker(WorkerInfo workerInfo)
workerInfo
- public int getTaskId()
public com.google.common.util.concurrent.ListenableFuture<V> getResponseFuture()
public void execute(BlockWorkerClient client, WorkerInfo workerInfo)
client
- worker clientworkerInfo
- the worker informationpublic void setJob(Job job)
job
- the jobpublic Job getJob()
public Task.TaskStat getTaskStat()
public int getPriority()
public void setPriority(int priority)
priority
- public int compareTo(Task o)
compareTo
in interface Comparable<Task>
Copyright © 2023. All Rights Reserved.