code: private void doRunningStateChange(RunningState newState) {
      RunningState oldState = null;
      JobExecutionStateListener stateListener = null;
      this.changeLock.lock();
      try {
        // verify transition
        if (null == this.runningState) {
          Preconditions.checkState(RunningState.PENDING == newState);
        }
        else {
          Preconditions.checkState(EXPECTED_PRE_TRANSITION_STATES.get(newState).contains(this.runningState),
              "unexpected state transition " + this.runningState + " --> " + newState);
        }
  
        oldState = this.runningState;
        this.runningState = newState;
        if (this.listener.isPresent()) {
          stateListener = this.listener.get();
        }
        this.runningStateChanged.signalAll();
      }
      finally {
        this.changeLock.unlock();
      }
      if (null != stateListener) {
        stateListener.onStatusChange(this, oldState, newState);
      }
    }
docs: This must be called only when holding changeLock