protected synchronized void persist() throws IOException {
      String localReplicaMountPath = localReplica.getReplicaPath();
      File temp = new File(localReplicaMountPath, REMOTE_TOKEN_FILE_NAME + ".tmp");
      File actual = new File(localReplicaMountPath, REMOTE_TOKEN_FILE_NAME);
      Map<String, Pair<Long, FindToken>> peerTokenSnapshot = getPeerReplicaAndToken();
      try {
        FileOutputStream fileStream = new FileOutputStream(temp);
        tokenSerde.serializeTokens(peerTokenSnapshot, fileStream);
        // swap temp file with the original file
        temp.renameTo(actual);
        logger.debug("Completed writing remote tokens to file {}", actual.getAbsolutePath());
      } catch (IOException e) {
        logger.error("IO error while persisting tokens to disk {}", temp.getAbsoluteFile());
        throw e;
      }
    }
Persist the remote peers and their tokens.
ambry-store/src/main/java/com/github/ambry/store/RemoteTokenTracker.java