Source:
<code>private void retrieveReplicaTokensAndPersistIfNecessary(String mountPath) throws ReplicationException, IOException { logger.info("Reading replica tokens for mount path {}", mountPath); boolean tokenWasReset = false; long readStartTimeMs = SystemTime.getInstance().milliseconds(); try { List<ReplicaTokenInfo> tokenInfoList = persistor.retrieveTokens(mountPath); for (ReplicaTokenInfo tokenInfo : tokenInfoList) { String hostname = tokenInfo.getHostname(); int port = tokenInfo.getPort(); PartitionId partitionId = tokenInfo.getPartitionId(); FindToken token = tokenInfo.getReplicaToken(); PartitionInfo partitionInfo = partitionsToReplicate.get(tokenInfo.getPartitionId()); if (partitionInfo != null) { boolean updatedToken = false; for (RemoteReplicaInfo remoteReplicaInfo : partitionInfo.getRemoteReplicaInfos()) { DataNodeId dataNodeId = remoteReplicaInfo.getReplicaId().getDataNodeId(); if (dataNodeId.getHostname().equalsIgnoreCase(hostname) && dataNodeId.getPort() == port && remoteReplicaInfo .getReplicaId() .getReplicaPath() .equals(tokenInfo.getReplicaPath())) { logger.info("Read token for partition remote host port token {}", partitionId, hostname, port, token); if (!partitionInfo.getStore().isEmpty()) { remoteReplicaInfo.initializeTokens(token); <START> remoteReplicaInfo.setTotalBytesReadFromLocalStore(tokenInfo.getTotalBytesReadFromLocalStore()); <END> } else { tokenWasReset = true; logTokenReset(partitionId, hostname, port, token); } updatedToken = true; break; } } if (!updatedToken) { logger.warn("Persisted remote replica host and port not present in new cluster ", hostname, port); } } else { tokenWasReset = true; logTokenReset(partitionId, hostname, port, token); } } } catch (IOException e) { throw new ReplicationException("IO error while reading from replica token file " + e); } finally { replicationMetrics.remoteReplicaTokensRestoreTime.update( SystemTime.getInstance().milliseconds() - readStartTimeMs); } if (tokenWasReset) { if (persistor != null) { persistor.write(mountPath, false); } else { logger.warn("Unable to persist after token reset, persistor is null"); } } }</code><technical_language>Is move ReplicaTokenInfo ReplicaTokeninfo RemoteReplicaInfo static classes</technical_language>

Target:
private void retrieveReplicaTokensAndPersistIfNecessary(String mountPath) throws ReplicationException, IOException { logger.info("Reading replica tokens for mount path {}", mountPath); boolean tokenWasReset = false; long readStartTimeMs = SystemTime.getInstance().milliseconds(); try { List<RemoteReplicaInfo.ReplicaTokenInfo> tokenInfoList = persistor.retrieve(mountPath); for (RemoteReplicaInfo.ReplicaTokenInfo tokenInfo : tokenInfoList) { String hostname = tokenInfo.getHostname(); int port = tokenInfo.getPort(); PartitionId partitionId = tokenInfo.getPartitionId(); FindToken token = tokenInfo.getReplicaToken(); PartitionInfo partitionInfo = partitionsToReplicate.get(tokenInfo.getPartitionId()); if (partitionInfo != null) { boolean updatedToken = false; for (RemoteReplicaInfo remoteReplicaInfo : partitionInfo.getRemoteReplicaInfos()) { DataNodeId dataNodeId = remoteReplicaInfo.getReplicaId().getDataNodeId(); if (dataNodeId.getHostname().equalsIgnoreCase(hostname) && dataNodeId.getPort() == port && remoteReplicaInfo .getReplicaId() .getReplicaPath() .equals(tokenInfo.getReplicaPath())) { logger.info("Read token for partition remote host port token {}", partitionId, hostname, port, token); if (!partitionInfo.getStore().isEmpty()) { remoteReplicaInfo.initializeTokens(token); remoteReplicaInfo.setTotalBytesReadFromLocalStore(tokenInfo.getTotalBytesReadFromLocalStore()); } else { tokenWasReset = true; logTokenReset(partitionId, hostname, port, token); } updatedToken = true; break; } } if (!updatedToken) { logger.warn("Persisted remote replica host and port not present in new cluster ", hostname, port); } } else { tokenWasReset = true; logTokenReset(partitionId, hostname, port, token); } } } catch (IOException e) { throw new ReplicationException("IO error while reading from replica token file " + e); } finally { replicationMetrics.remoteReplicaTokensRestoreTime.update( SystemTime.getInstance().milliseconds() - readStartTimeMs); } if (tokenWasReset) { if (persistor != null) { persistor.write(mountPath, false); } else { logger.warn("Unable to persist after token reset, persistor is null"); } } }