@Override
    public void onPartitionBecomeBootstrapFromOffline(String partitionName) {
      // check if partition exists
      ReplicaId replica = storageManager.getReplica(partitionName);
      if (replica == null) {
        // no matter this is an existing replica or new added one, it should be present in storage manager because new
        // replica is added into storage manager first.
        throw new StateTransitionException("Replica " + partitionName + " is not found on current node",
            ReplicaNotFound);
      }
      if (!partitionToReplicaMap.containsKey(replica.getPartitionId())) {
        // if replica is not present in partitionToReplicaMap, it means this new replica was just added into storage
        // manager. Here we add it into stats manager accordingly.
        logger.info("Didn't find replica {} in stats manager, starting to add it.", partitionName);
        if (!addReplica(replica)) {
          throw new StateTransitionException("Failed to add new replica into stats manager", ReplicaOperationFailure);
        }
      }
    }
{@link PartitionStateChangeListener} to capture changes in partition state.
ambry-server/src/main/java/com/github/ambry/server/StatsManager.java