code: private void updateHeartbeatTime(MemberState member, Throwable error) {
      if (heartbeatFuture == null) {
        return;
      }
  
      if (error != null && member.getHeartbeatStartTime() == heartbeatTime) {
        int votingMemberSize = context.getClusterState().getActiveMemberStates().size() + (context.getCluster().member().type() == Member.Type.ACTIVE ? 1 : 0);
        int quorumSize = (int) Math.floor(votingMemberSize / 2) + 1;
        // If a quorum of successful responses cannot be achieved, fail this heartbeat. Ensure that only
        // ACTIVE members are considered. A member could have been transitioned to another state while the
        // heartbeat was being sent.
        if (member.getMember().type() == Member.Type.ACTIVE && ++heartbeatFailures > votingMemberSize - quorumSize) {
          heartbeatFuture.completeExceptionally(new InternalException("Failed to reach consensus"));
          completeHeartbeat();
        }
      } else {
        member.setHeartbeatTime(System.currentTimeMillis());
  
        // Sort the list of commit times. Use the quorum index to get the last time the majority of the cluster
        // was contacted. If the current heartbeatFuture's time is less than the commit time then trigger the
        // commit future and reset it to the next commit future.
        if (heartbeatTime <= heartbeatTime()) {
          heartbeatFuture.complete(null);
          completeHeartbeat();
        }
      }
    }
docs: Sets a commit time or fails the commit if a quorum of successful responses cannot be achieved.