code: private void changeStateTo(int newState) {
      int oldState = this.status.getRunState();
      if (oldState == newState) {
        return; //old and new states are same
      }
      this.status.setRunState(newState);
  
      //update the metrics
      if (oldState == JobStatus.PREP) {
        this.jobtracker.getInstrumentation().decPrepJob(conf, jobId);
      } else if (oldState == JobStatus.RUNNING) {
        this.jobtracker.getInstrumentation().decRunningJob(conf, jobId);
      }
  
      if (newState == JobStatus.PREP) {
        this.jobtracker.getInstrumentation().addPrepJob(conf, jobId);
      } else if (newState == JobStatus.RUNNING) {
        this.jobtracker.getInstrumentation().addRunningJob(conf, jobId);
      }
  
    }
docs: Job state change must happen thru this call