void resolvePartitionState() {
    // If there was a change to the sealed state of replicas in the cluster manager since the last check, refresh the
    // state of this partition. We do this to avoid querying every time this method is called, considering how
    // update to sealed states of replicas are relatively rare.
    long currentCounterValue = clusterManagerQueryHelper.getSealedStateChangeCounter();
    // if the lock could not be taken, that means the state is being updated in another thread. Avoid updating the
    // state in that case.
    if (currentCounterValue > lastUpdatedSealedStateChangeCounter && stateChangeLock.tryLock()) {
      ReplicaSealStatus mergedReplicaSealStatus = ReplicaSealStatus.NOT_SEALED;
      try {
        lastUpdatedSealedStateChangeCounter = currentCounterValue;
        AmbryReplica partiallySealedReplica = null;
        for (AmbryReplica replica : clusterManagerQueryHelper.getReplicaIdsForPartition(this)) {
          mergedReplicaSealStatus =
              ReplicaSealStatus.mergeReplicaSealStatus(mergedReplicaSealStatus, replica.getSealedStatus());
          if (mergedReplicaSealStatus == ReplicaSealStatus.SEALED) {
            LOGGER.trace("Partition {} is sealed because replica {} is sealed at sealedStateChangeCounter {}", id,
                replica.getDataNodeId().toString(), lastUpdatedSealedStateChangeCounter);
            break;
          }
          if (mergedReplicaSealStatus == ReplicaSealStatus.PARTIALLY_SEALED) {
            partiallySealedReplica = replica;
          }
        }
        if (mergedReplicaSealStatus == ReplicaSealStatus.PARTIALLY_SEALED) {
          LOGGER.trace(
              "Partition {} is partially sealed because replica {} is partially sealed at sealedStateChangeCounter {}",
              id, partiallySealedReplica.getDataNodeId().toString(), lastUpdatedSealedStateChangeCounter);
        }
        state = ClusterMapUtils.convertReplicaSealStatusToPartitionState(mergedReplicaSealStatus);
      } finally {
        stateChangeLock.unlock();
      }
    }
  }
Resolves the {@link PartitionState} based on the state of the replicas.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/AmbryPartition.java