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 Map<String, ControlledJob> getQueue(State state) { Map<String, ControlledJob> retv = null; if (state == State.WAITING) { retv = this.waitingJobs; } else if (state == State.READY) { retv = this.readyJobs; } else if (state == State.RUNNING) { retv = this.runningJobs; } else if (state == State.SUCCESS) { retv = this.successfulJobs; } else if (state == State.FAILED || state == State.DEPENDENT_FAILED) { retv = this.failedJobs; } return retv; }
/** * Add a new job. * @param aJob the new job */ synchronized public String addJob(ControlledJob aJob) { String id = this.getNextJobID(); aJob.setJobID(id); aJob.setJobState(State.WAITING); this.addToQueue(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); } }
/** * Add a new job. * @param aJob the new job */ synchronized public String addJob(ControlledJob aJob) { String id = this.getNextJobID(); aJob.setJobID(id); aJob.setJobState(State.WAITING); jobsInProgress.add(aJob); return id; }
/** * @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); }