示例#1
0
  private void handleSuspect(Suspect ev) {

    if (ev.getDir() == Direction.UP) {
      if (ls.failed[ev.orig]) {
        log.debug("Invalid (failed) message source");
        return;
      }

      ev.failed = ArrayOptimized.popArrayBoolean(ev.getMessage());
    }

    if (ev.failed[ls.my_rank]) {
      log.debug("i am not failed !!");
      return;
    }

    int i;
    boolean[] new_failed = null;

    for (i = 0; i < ev.failed.length; i++) {
      if (ev.failed[i] && !ls.failed[i]) {
        ls.fail(i);
        if (new_failed == null) {
          new_failed = new boolean[ls.failed.length];
          Arrays.fill(new_failed, false);
        }
        new_failed[i] = true;
      }
    }

    if (new_failed != null) {
      if (ev.getDir() == Direction.DOWN) {
        ArrayOptimized.pushArrayBoolean(ls.failed, ev.getMessage());
        // ev.getObjectsMessage().push(ls.failed);
        try {
          ev.go();
        } catch (AppiaEventException ex) {
          ex.printStackTrace();
        }
      }

      sendFail(new_failed, ev.getChannel());
    }
  }
示例#2
0
 private void sendSuspect(boolean[] failed, Channel channel) {
   try {
     Suspect ev = new Suspect(failed, channel, Direction.DOWN, this, vs.group, vs.id);
     ArrayOptimized.pushArrayBoolean(ls.failed, ev.getMessage());
     // ev.getObjectsMessage().push(ls.failed);
     ev.go();
   } catch (AppiaEventException ex) {
     ex.printStackTrace();
     log.warn("Impossible to send Suspect");
   }
 }