@Override
  public boolean isAvailable(Object id, List<AbstractHeartbeatSample> history) {
    if (history.size() < codeStartSampleCount) {
      /* We haven't received enough heartbeat replies.*/
      return fallbackDuringColdStart.isAvailable(id, history);
    }
    final PhiAccrual phiAccrual = create(history);
    final boolean isAvailable = phiAccrual.phi() < (double) this.threshold;

    final Boolean previousAvailability = availibilityCache.getIfPresent(id);
    availibilityCache.put(id, isAvailable);

    if (Boolean.TRUE.equals(previousAvailability) && !isAvailable) {
      // log the status change and dump the heartbeat history for analysis use
      final StringBuilder builder = new StringBuilder();
      builder.append("[");
      for (double interval : phiAccrual.heartbeatIntervals) {
        final long msInterval = (long) interval / 1000_000;
        builder.append(msInterval).append(", ");
      }
      builder.append(phiAccrual.timeElapsedSinceLastHeartbeat / 1000_000);
      builder.append("]");
      LOGGER.info(String.format("Node %s Down, heartbeat history (ms): %s", id, builder));
    }

    return isAvailable;
  }
The Phi Failure Detector, proposed by Hayashibara, Naohiro, et al. "The/spl phi/accrual failure
detector.". It is an accrual approach based on heartbeat history analysis with dynamic
sensitivity and tunable threshold. It is adaptive with early failure detection, increased
accuracy and improved system stability.

<p>Initially, Phi has a cold start period where it will only collect heartbeat samples and
fallback decision-making to {@link FixedDetector}. After collecting enough samples, it will start
failure detection using the Phi algo.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/detector/PhiAccrualDetector.java