public void transitionState(final State update, final State... expected)
    throws UnexpectedStateException {
    if (!setState(update, expected)) {
      throw new UnexpectedStateException("Expected " + Arrays.toString(expected)
        + " so could move to " + update + " but current state=" + getState());
    }
  }
Set new {@link State} but only if currently in <code>expected</code> State (if not, throw
{@link UnexpectedStateException}.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java