code: public static Job startOneJob(Worker newWorker, 
        Priority pri, Set<String> jobFiles, long detectTime, 
        AtomicLong numFilesSubmitted, AtomicLong lastCheckingTime,
        long maxPendingJobs) 
            throws IOException, InterruptedException, ClassNotFoundException {
      if (lastCheckingTime != null) {
        lastCheckingTime.set(System.currentTimeMillis());
      }
      String startTimeStr = dateFormat.format(new Date());
      String jobName = newWorker.JOB_NAME_PREFIX + "." + newWorker.jobCounter + 
          "." + pri + "-pri" + "." + startTimeStr;
      Job job = null;
      synchronized(jobFiles) {
        if (jobFiles.size() == 0) {
          return null;
        }
        newWorker.jobCounter++;
        
        synchronized(newWorker.jobIndex) {
          if (newWorker.jobIndex.size() >= maxPendingJobs) {
            // full 
            return null;
          }
          job = newWorker.startJob(jobName, jobFiles, pri, detectTime);
        }
        numFilesSubmitted.addAndGet(jobFiles.size());
        jobFiles.clear();
        
      }
      return job;
    }
docs: Return true if succeed to start one job