StatusEntry se = new StatusEntry(nodeName, NODE, null); statusMap.put(se.name, se); setCurrentState(se.name, controller.getNormalState()); queueChangeEvent( new CommunityStatusChangeEvent(CommunityStatusChangeEvent.MEMBERS_ADDED, se));
  public void applyUpdates(String nodeName, int nodeStatus, AgentStatus[] as, String vote, String host) {    synchronized (statusMap) {      if (logger.isDebugEnabled()) {        logger.debug("ApplyUpdates:" +                     " node=" + nodeName +                     " nodeStatus=" + controller.stateName(nodeStatus) +                     " numAgents=" + as.length);      }      if (statusMap.containsKey(nodeName)) {        setTimestamp(nodeName);        setCurrentState(nodeName, nodeStatus);        setLeaderVote(nodeName, vote);        setLocation(nodeName, host);      } else {        StatusEntry se = new StatusEntry(nodeName, NODE, null);        statusMap.put(se.name, se);        setCurrentState(se.name, controller.getNormalState());        queueChangeEvent(          new CommunityStatusChangeEvent(CommunityStatusChangeEvent.MEMBERS_ADDED, se));      }      // Apply agent status changes      for (int i = 0; i < as.length; i++) {        String agentName = as[i].getName();        if (statusMap.containsKey(agentName)) {          setTimestamp(as[i].getName());          setVersion(agentName, as[i].getVersion());          setLocation(agentName, nodeName);          setCurrentState(agentName, as[i].getStatus());        }      }    }    queueChangeEvent(      new CommunityStatusChangeEvent(CommunityStatusChangeEvent.STATUS_UPDATE_RECEIVED,                                     nodeName,                                     UNDEFINED,                                     UNDEFINED,                                     UNDEFINED,                                     null,                                     null,                                     null,                                     null));  }