if ((wakeAlarm != null) && ((wakeAlarm.hasExpired()))) { updateAndSendNodeStatus(); wakeAlarm = new WakeAlarm((new Date()).getTime() + NODE_CHECK_INTERVAL); alarmService.addRealTimeAlarm(wakeAlarm); }
  protected void execute() {    for (Iterator it = searchRequests.getChangedCollection().iterator(); it.hasNext(); ) {      SearchCommunity cs = (SearchCommunity) it.next();      Collection robustnessCommunities = (Collection)cs.getResponse().getContent();      if (robustnessCommunities != null) {        for (Iterator it1 = robustnessCommunities.iterator(); it1.hasNext();) {          Community c = (Community)it1.next();          logger.debug("Received changed SearchCommunity:" +                      " community=" + (c != null ? c.getName() : null));        }        processCommunityChanges(robustnessCommunities);      }    }    // Get status from other node agents in community    Collection nsCollection = nodeStatusRelaySub.getAddedCollection();    for (Iterator it = nsCollection.iterator(); it.hasNext(); ) {      NodeStatusRelay nsr = (NodeStatusRelay)it.next();      logger.debug("Received added NodeStatusRelay:" +                  " community=" + nsr.getCommunityName() +                  " source=" + nsr.getSource() +                  " numAgents=" + nsr.getAgentStatus().length +                  " leaderVote=" + nsr.getLeaderVote());      updateCommunityStatus(nsr.getCommunityName(),                            nsr.getSource().toString(),                            nsr.getNodeStatus(),                            nsr.getAgentStatus(),                            nsr.getLeaderVote());    }    nsCollection = nodeStatusRelaySub.getChangedCollection();    for (Iterator it = nsCollection.iterator(); it.hasNext(); ) {      NodeStatusRelay nsr = (NodeStatusRelay)it.next();      logger.debug("Received changed NodeStatusRelay:" +                  " community=" + nsr.getCommunityName() +                  " source=" + nsr.getSource() +                  " numAgents=" + nsr.getAgentStatus().length +                  " leaderVote=" + nsr.getLeaderVote());      updateCommunityStatus(nsr.getCommunityName(),                            nsr.getSource().toString(),                            nsr.getNodeStatus(),                            nsr.getAgentStatus(),                            nsr.getLeaderVote());    }    // Get HealthMonitorRequests    for (Iterator it = healthMonitorRequests.getAddedCollection().iterator(); it.hasNext(); ) {      HealthMonitorRequest hsm = (HealthMonitorRequest)it.next();      logger.debug("Received HealthMonitorRequest:" + hsm);      switch (hsm.getRequestType()) {        case HealthMonitorRequest.MOVE:          break;        case HealthMonitorRequest.GET_STATUS:          int respStatus = HealthMonitorResponse.FAIL;          String respObj = null;          if (model != null) {            respStatus = HealthMonitorResponse.SUCCESS;            respObj = controller.getCompleteStatus();          }          hsm.setResponse(new HealthMonitorResponse(respStatus, respObj));          blackboard.publishChange(hsm);      }    }  }