T
- the type of the task of the jobpublic abstract class AbstractJob<T extends Task<?>> extends Object implements Job<T>
Modifier and Type | Field and Description |
---|---|
protected OptionalLong |
mEndTime |
protected String |
mJobId |
protected LinkedHashSet<T> |
mRetryTaskList |
protected long |
mStartTime |
protected JobState |
mState |
protected AtomicInteger |
mTaskIdGenerator |
protected Optional<String> |
mUser |
protected WorkerAssignPolicy |
mWorkerAssignPolicy |
Constructor and Description |
---|
AbstractJob(Optional<String> user,
String jobId)
Creates a new instance of
AbstractJob . |
AbstractJob(Optional<String> user,
String jobId,
WorkerAssignPolicy workerAssignPolicy)
Creates a new instance of
AbstractJob . |
Modifier and Type | Method and Description |
---|---|
OptionalLong |
getEndTime()
Get end time.
|
String |
getJobId() |
JobState |
getJobState()
Get load status.
|
WorkerAssignPolicy |
getWorkerAssignPolicy()
Gets the worker assign policy.
|
void |
initializeJob()
Initialize the job before kick it running.
|
boolean |
isDone()
Check whether the job is finished.
|
boolean |
isRunning()
Check whether the job is still running.
|
void |
onTaskSubmitFailure(Task<?> task)
Define how to process task that gets rejected when scheduler tried to kick off.
|
void |
setEndTime(long time)
Update end time.
|
void |
setJobState(JobState state,
boolean journalUpdate)
Set load state.
|
void |
setStartTime(long time)
Update start time.
|
void |
setWorkerAssignPolicy(WorkerAssignPolicy assignPolicy)
Sets the worker assign policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
failJob, getDescription, getNextTasks, getProgress, hasFailure, initiateVerification, isCurrentPassDone, isHealthy, needVerification, processResponse, setJobSuccess, toJournalEntry
protected final String mJobId
protected final AtomicInteger mTaskIdGenerator
protected JobState mState
protected OptionalLong mEndTime
protected long mStartTime
protected final LinkedHashSet<T extends Task<?>> mRetryTaskList
protected WorkerAssignPolicy mWorkerAssignPolicy
public AbstractJob(Optional<String> user, String jobId)
AbstractJob
.user
- the user who submitted the jobjobId
- the job idpublic AbstractJob(Optional<String> user, String jobId, WorkerAssignPolicy workerAssignPolicy)
AbstractJob
.user
- jobId
- workerAssignPolicy
- public void setWorkerAssignPolicy(WorkerAssignPolicy assignPolicy)
assignPolicy
- the assign policypublic WorkerAssignPolicy getWorkerAssignPolicy()
public String getJobId()
public OptionalLong getEndTime()
getEndTime
in interface Job<T extends Task<?>>
public void setEndTime(long time)
time
- time in mspublic void setStartTime(long time)
time
- time in mspublic JobState getJobState()
getJobState
in interface Job<T extends Task<?>>
public void setJobState(JobState state, boolean journalUpdate)
setJobState
in interface Job<T extends Task<?>>
state
- new statejournalUpdate
- true if state change needs to be journaledpublic void onTaskSubmitFailure(Task<?> task)
Job
onTaskSubmitFailure
in interface Job<T extends Task<?>>
public boolean isRunning()
Job
public boolean isDone()
Job
public void initializeJob()
Job
initializeJob
in interface Job<T extends Task<?>>
Copyright © 2023. All Rights Reserved.