code: protected void changeState(State from, State to) throws Exception {
      if (!this.state.compareAndSet(from, to)) {
        throw new Exception("Cannot change state from " + from + " to " + to + " for " + this);
      }
      publishState(from, to);
    }
docs: First changes the state from a current value to a target
  value. Second, publishes the change of state to all the
  listeners through {@link #getStateListeners()}.
  
  @param from the current state
  @param to the new state
  @throws Exception if the state cannot be changed or some
  {@link StateListener}failed to apply the same
  change.