code: protected synchronized JobStatus addJob(JobID jobId, JobInProgress job) {
      totalSubmissions++;
  
      synchronized (jobs) {
        synchronized (taskScheduler) {
          jobs.put(job.getProfile().getJobID(), job);
          for (JobInProgressListener listener : jobInProgressListeners) {
            try {
              listener.jobAdded(job);
            } catch (IOException ioe) {
              LOG.warn("Failed to add and so skipping the job : "
                  + job.getJobID() + ". Exception : " + ioe);
            }
          }
        }
      }
      myInstrumentation.submitJob(job.getJobConf(), jobId);
      String jobName = job.getJobConf().getJobName();
      int jobNameLen = 64;
      if (jobName.length() > jobNameLen) {
        jobName = jobName.substring(0, jobNameLen); // Truncate for logging.
      }
      LOG.info("Job " + jobId + "(" + jobName +
               ") added successfully for user '" + job.getJobConf().getUser() +
               "' to queue '" + job.getJobConf().getQueueName() + "'" +
               ", source " + job.getJobConf().getJobSource());
      return job.getStatus();
    }
docs: Adds a job to the jobtracker. Make sure that the checks are inplace before
  adding a job. This is the core job submission logic
  @param jobId The id for the job submitted which needs to be added