public boolean setState(final State update, final State... expected) {
    if (!isInState(expected)) {
      return false;
    }
    this.state = update;
    this.lastUpdate = EnvironmentEdgeManager.currentTime();
    return true;
  }
@param update   new region state this node should be assigned.
@param expected current state should be in this given list of expected states
@return true, if current state is in expected list; otherwise false.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateNode.java