示例#1
0
 @Override
 public void report(InetAddress ep) {
   if (logger.isTraceEnabled()) logger.trace("reporting {}", ep);
   long now = System.nanoTime();
   ArrivalWindow heartbeatWindow = arrivalSamples.get(ep);
   if (heartbeatWindow == null) {
     // avoid adding an empty ArrivalWindow to the Map
     heartbeatWindow = new ArrivalWindow(SAMPLE_SIZE);
     heartbeatWindow.add(now);
     arrivalSamples.put(ep, heartbeatWindow);
   } else {
     heartbeatWindow.add(now);
   }
 }
示例#2
0
  @Override
  public void interpret(InetAddress ep) {
    ArrivalWindow hbWnd = arrivalSamples.get(ep);
    if (hbWnd == null) {
      return;
    }
    long now = System.nanoTime();
    double phi = hbWnd.phi(now);
    if (logger.isTraceEnabled()) logger.trace("PHI for {} : {}", ep, phi);

    if (PHI_FACTOR * phi > getPhiConvictThreshold()) {
      logger.trace("notifying listeners that {} is down", ep);
      logger.trace("intervals: {} mean: {}", hbWnd, hbWnd.mean());
      for (IFailureDetectionEventListener listener : fdEvntListeners) {
        listener.convict(ep, phi);
      }
    }
  }