下面列出了org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.State 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
synchronized private List<ControlledJob> getJobsIn(State state) {
LinkedList<ControlledJob> l = new LinkedList<ControlledJob>();
for(ControlledJob j: jobsInProgress) {
if(j.getJobState() == state) {
l.add(j);
}
}
return l;
}
/**
* Add a new controlled job.
* @param aJob the new controlled job
*/
synchronized public String addJob(ControlledJob aJob) {
String id = this.getNextJobID();
aJob.setJobID(id);
aJob.setJobState(State.WAITING);
jobsInProgress.add(aJob);
return id;
}
synchronized private List<ControlledJob> getJobsIn(State state) {
LinkedList<ControlledJob> l = new LinkedList<ControlledJob>();
for(ControlledJob j: jobsInProgress) {
if(j.getJobState() == state) {
l.add(j);
}
}
return l;
}
/**
* Add a new controlled job.
* @param aJob the new controlled job
*/
synchronized public String addJob(ControlledJob aJob) {
String id = this.getNextJobID();
aJob.setJobID(id);
aJob.setJobState(State.WAITING);
jobsInProgress.add(aJob);
return id;
}
private State checkState(ControlledJob j) {
try {
return (State)checkState.invoke(j);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private State submit(ControlledJob j) {
try {
return (State)submit.invoke(j);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @return the jobs in the waiting state
*/
public List<ControlledJob> getWaitingJobList() {
return getJobsIn(State.WAITING);
}
/**
* @return the jobs in the running state
*/
public List<ControlledJob> getRunningJobList() {
return getJobsIn(State.RUNNING);
}
/**
* @return the jobs in the ready state
*/
public List<ControlledJob> getReadyJobsList() {
return getJobsIn(State.READY);
}
/**
* @return the jobs in the waiting state
*/
public List<ControlledJob> getWaitingJobList() {
return getJobsIn(State.WAITING);
}
/**
* @return the jobs in the running state
*/
public List<ControlledJob> getRunningJobList() {
return getJobsIn(State.RUNNING);
}
/**
* @return the jobs in the ready state
*/
public List<ControlledJob> getReadyJobsList() {
return getJobsIn(State.READY);
}