@Override
  public StateModel createNewStateModel(String resourceName, String partitionName) {
    StateModel stateModelToReturn;
    switch (clustermapConfig.clustermapStateModelDefinition) {
      case AmbryStateModelDefinition.AMBRY_LEADER_STANDBY_MODEL:
        stateModelToReturn =
            new AmbryPartitionStateModel(resourceName, partitionName, partitionStateChangeListener, clustermapConfig,
                clusterManager);
        break;
      case LeaderStandbySMD.name:
        stateModelToReturn = new DefaultLeaderStandbyStateModel();
        break;
      default:
        // Code won't get here because state model def is already validated in ClusterMapConfig. We keep exception here
        // in case the validation logic is changed in ClusterMapConfig.
        throw new IllegalArgumentException(
            "Unsupported state model definition: " + clustermapConfig.clustermapStateModelDefinition);
    }
    return stateModelToReturn;
  }
Create and return an instance of {@link StateModel} based on given definition
@param resourceName the resource name for which this state model is being created.
@param partitionName the partition name for which this state model is being created.
@return an instance of {@link StateModel}.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/AmbryStateModelFactory.java