@Override
  public boolean isDown() {
    boolean down = false;
    if (hardDown.get()) {
      down = true;
    } else if (failureCount.get() >= failureCountThreshold) {
      if (time.milliseconds() < downUntil.get()) {
        down = true;
      }
    }

    if (down) {
      logger.trace(
          "Resource {} is down; failureCount: {}; failureCountThreshold: {}; remaining time: {}; hard down: {}",
          resource, failureCount.get(), failureCountThreshold, downUntil.get() - time.milliseconds(), hardDown);
    } else {
      logger.trace("Resource {} is not down; failureCount: {}; failureCountThreshold: {}", resource, failureCount.get(),
          failureCountThreshold);
    }
    return down;
  }
If the number of failures are above the threshold, the resource will be counted as down unless downUntil is in
the past.
Note how failureCount is not reset to 0 here. This is so that the node is marked as down if the first request after
marking a node back up, also times out. We only reset failureCount on an actual response, so down nodes get a
'chance' to prove they are back up every retryBackoffMs - they do not get 'fully up' status until they are actually
responsive.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/FixedBackoffResourceStatePolicy.java