protected boolean inlineCheckIfAvailable(final ID initiator,
      final GMSMembershipView<ID> cv, boolean isFinalCheck, final ID mbr,
      final String reason) {

    if (services.getJoinLeave().isMemberLeaving(mbr)) {
      return false;
    }

    boolean failed = false;

    logger.info("Performing availability check for suspect member {} reason={}", mbr, reason);
    membersInFinalCheck.add(mbr);
    setNextNeighbor(currentView, mbr);

    try {
      services.memberSuspected(initiator, mbr, reason);
      long startTime = System.currentTimeMillis();
      // for some reason we used to update the timestamp for the member
      // with the startTime, but we don't want to do that because it looks
      // like a heartbeat has been received

      boolean pinged;
      int port = cv.getFailureDetectionPort(mbr);
      if (port <= 0) {
        logger.info("Unable to locate failure detection port - requesting a heartbeat");
        if (logger.isDebugEnabled()) {
          logger.debug("\ncurrent view: {}\nports: {}", cv,
              Arrays.toString(cv.getFailureDetectionPorts()));
        }
        pinged = doCheckMember(mbr, true);
        stats.incFinalCheckRequestsSent();
        stats.incUdpFinalCheckRequestsSent();
        if (pinged) {
          stats.incFinalCheckResponsesReceived();
          stats.incUdpFinalCheckResponsesReceived();
        }
      } else {
        // this will just send heartbeat request, it will not wait for response
        // if we will get heartbeat then it will change the timestamp, which we are
        // checking below in case of tcp check failure..
        doCheckMember(mbr, false);
        // now, while waiting for a heartbeat, try connecting to the suspect's failure detection
        // port
        final boolean retryIfConnectFails = isFinalCheck;
        pinged = doTCPCheckMember(mbr, port, retryIfConnectFails);
      }

      if (!pinged && !isStopping) {
        failed = true;
        TimeStamp ts = memberTimeStamps.get(mbr);
        if (ts == null || ts.getTime() < startTime) {
          logger.info("Availability check failed for member {}", mbr);
          // if the final check fails & this VM is the coordinator we don't need to do another final
          // check
          if (isFinalCheck) {
            logger.info("Requesting removal of suspect member {}", mbr);
            services.getJoinLeave().remove(mbr, reason);
            // make sure it is still suspected
            memberSuspected(localAddress, mbr, reason);
          } else {
            // if this node can survive an availability check then initiate suspicion about
            // the node that failed the availability check
            if (doTCPCheckMember(localAddress, socketPort, false)) {
              membersInFinalCheck.remove(mbr);
              // tell peers about this member and then perform another availability check
              memberSuspected(localAddress, mbr, reason);
              initiateSuspicion(mbr, reason);
              SuspectMembersMessage<ID> suspectMembersMessage =
                  new SuspectMembersMessage<>(Collections.singletonList(localAddress),
                      Collections
                          .singletonList(new SuspectRequest<>(mbr, "failed availability check")));
              suspectMembersMessage.setSender(localAddress);
              logger.debug("Performing local processing on suspect request");
              processMessage(suspectMembersMessage);
            } else {
              logger.info(
                  "Self-check for availability failed - will not continue to suspect {} for now",
                  mbr);
              failed = false;
            }
          }
        } else {
          logger.info(
              "Availability check detected recent message traffic for suspect member "
                  + mbr + " at time " + new Date(ts.getTime()));
          failed = false;
        }
      }

      if (!failed) {
        if (!isStopping
            && initiator.getVersionOrdinal() >= KnownVersion.GEODE_1_4_0.ordinal()) {
          // let others know that this member is no longer suspect
          FinalCheckPassedMessage<ID> message = new FinalCheckPassedMessage<>(initiator, mbr);
          List<ID> members = cv.getMembers();
          List<ID> recipients = new ArrayList<>(members.size());
          for (ID member : members) {
            if (!isSuspectMember(member) && !membersInFinalCheck.contains(member) &&
                !member.equals(localAddress)) {
              recipients.add(member);
            }
          }
          if (recipients.size() > 0) {
            message.setRecipients(recipients);
            services.getMessenger().send(message);
          }
        }

        logger.info("Availability check passed for suspect member " + mbr);
      }
    } finally {
      if (!failed) {
        memberUnsuspected(mbr);
        setNextNeighbor(currentView, null);
      }
      membersInFinalCheck.remove(mbr);
    }
    return !failed;
  }
Check to see if a member is available

@param initiator member who initiated this check
@param cv the view we're basing the check upon
@param isFinalCheck whether the member should be kicked out if it fails the check
@param mbr the member to check
@param reason why we're doing this check
@return true if the check passes
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java