/** * JobTracker.submitJob() kicks off a new job. * * <p>Create a 'JobInProgress' object, which contains both JobProfile and JobStatus. Those two * sub-objects are sometimes shipped outside of the JobTracker. But JobInProgress adds info that's * useful for the JobTracker alone. * * <p>We add the JIP to the jobInitQueue, which is processed asynchronously to handle * split-computation and build up the right TaskTracker/Block mapping. */ public synchronized JobStatus submitJob(String jobFile) throws IOException { totalSubmissions++; JobInProgress job = new JobInProgress(jobFile, this, this.conf); synchronized (jobs) { synchronized (jobsByArrival) { synchronized (jobInitQueue) { jobs.put(job.getProfile().getJobId(), job); jobsByArrival.add(job); jobInitQueue.add(job); jobInitQueue.notifyAll(); } } } return job.getStatus(); }
public void messageReceived(int to, MessageJ m) { try { if (m.getType() == AgillaTSResMsg.AM_TYPE) { log("Got a results message: " + m); // results = (AgillaTSResMsgJ)m; synchronized (response) { response.add(m); // if (timer != null) timer.kill(); response.notifyAll(); } } else if (m.getType() == AgillaTSReqMsg.AM_TYPE) { AgillaTSReqMsgJ reqMsg = (AgillaTSReqMsgJ) m; log("Got a request message: " + m); processRequest(reqMsg); } } catch (Exception e) { e.printStackTrace(); } }