code: private void setState(final RunnableProcessState newState) {
      if (!this.state.isLegal(newState)) {
        throw new IllegalStateException("Transition from " + this.state + " to " + newState + " is illegal");
      }
      this.state = newState;
    }
docs: Sets a new state for the process.
  @param newState a new process state to transition to.
  @throws IllegalStateException if the new state is illegal.