Example #1
0
  void notifyFailureDetector(Map<InetAddress, EndpointState> remoteEpStateMap) {
    IFailureDetector fd = FailureDetector.instance;
    for (Entry<InetAddress, EndpointState> entry : remoteEpStateMap.entrySet()) {
      InetAddress endpoint = entry.getKey();
      EndpointState remoteEndpointState = entry.getValue();
      EndpointState localEndpointState = endpointStateMap_.get(endpoint);
      /*
       * If the local endpoint state exists then report to the FD only
       * if the versions workout.
       */
      if (localEndpointState != null) {
        int localGeneration = localEndpointState.getHeartBeatState().generation_;
        int remoteGeneration = remoteEndpointState.getHeartBeatState().generation_;
        if (remoteGeneration > localGeneration) {
          fd.report(endpoint);
          continue;
        }

        if (remoteGeneration == localGeneration) {
          int localVersion = getMaxEndpointStateVersion(localEndpointState);
          // int localVersion = localEndpointState.getHeartBeatState().getHeartBeatVersion();
          int remoteVersion = remoteEndpointState.getHeartBeatState().getHeartBeatVersion();
          if (remoteVersion > localVersion) {
            fd.report(endpoint);
          }
        }
      }
    }
  }
Example #2
0
  void notifyFailureDetector(List<GossipDigest> gDigests) {
    IFailureDetector fd = FailureDetector.instance;
    for (GossipDigest gDigest : gDigests) {
      EndpointState localEndpointState = endpointStateMap_.get(gDigest.endpoint_);
      /*
       * If the local endpoint state exists then report to the FD only
       * if the versions workout.
       */
      if (localEndpointState != null) {
        int localGeneration =
            endpointStateMap_.get(gDigest.endpoint_).getHeartBeatState().generation_;
        int remoteGeneration = gDigest.generation_;
        if (remoteGeneration > localGeneration) {
          fd.report(gDigest.endpoint_);
          continue;
        }

        if (remoteGeneration == localGeneration) {
          int localVersion = getMaxEndpointStateVersion(localEndpointState);
          // int localVersion =
          // endpointStateMap_.get(gDigest.endpoint_).getHeartBeatState().getHeartBeatVersion();
          int remoteVersion = gDigest.maxVersion_;
          if (remoteVersion > localVersion) {
            fd.report(gDigest.endpoint_);
          }
        }
      }
    }
  }