public final void write(String mountPath, boolean shuttingDown) throws IOException, ReplicationException {
    long writeStartTimeMs = SystemTime.getInstance().milliseconds();

    // Get all partitions for the mount path and persist their tokens
    List<ReplicaTokenInfo> tokensPersisted = new ArrayList<>();
    for (PartitionInfo info : partitionGroupedByMountPath.get(mountPath)) {
      for (RemoteReplicaInfo remoteReplica : info.getRemoteReplicaInfos()) {
        FindToken tokenToPersist = remoteReplica.getTokenToPersist();
        if (tokenToPersist != null) {
          tokensPersisted.add(new ReplicaTokenInfo(remoteReplica));
        }
      }
    }

    try {
      persist(mountPath, tokensPersisted);
    } finally {
      // TODO: could move this out
      replicationMetrics.remoteReplicaTokensPersistTime.update(
          SystemTime.getInstance().milliseconds() - writeStartTimeMs);
    }

    for (ReplicaTokenInfo replicaTokenInfo : tokensPersisted) {
      replicaTokenInfo.getReplicaInfo().onTokenPersisted();
      if (shuttingDown) {
        logger.info("Persisted token {}", replicaTokenInfo.getReplicaToken());
      }
    }
  }
Method to persist the token of partition(s) under the same mountPath.
@param mountPath The mouth path of the partition(s).
@param shuttingDown indicates whether this is being called as part of shut down.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicaTokenPersistor.java