StatusEntry se = new StatusEntry(); se.name = entity.getName(); se.type = type; se.currentState = -1; se.ttl = DEFAULT_TTL; se.timestamp = new Date(); se.attrs = entity.getAttributes(); statusMap.put(se.name, se);  queueChangeEvent( new CommunityStatusChangeEvent(CommunityStatusChangeEvent.MEMBERS_ADDED, se.name, se.type, se.currentState, -1, se.currentLocation, null, null, null));
  public void update(Community community) {    synchronized (statusMap) {      communityAttrs = community.getAttributes();      try {        Attribute attr = communityAttrs.get("Manager");        if (attr != null)          setPreferredLeader((String)attr.get());      } catch (NamingException ne) {}      for (Iterator it = community.getEntities().iterator(); it.hasNext(); ) {        Entity entity = (Entity) it.next();        if (entity instanceof Agent && !statusMap.containsKey(entity.getName())) {          int type = AGENT;          Attribute entityTypeAttr = entity.getAttributes().get("EntityType");          if (entityTypeAttr != null && entityTypeAttr.contains("Node")) {            type = NODE;            electLeader();          }          StatusEntry se = new StatusEntry();          se.name = entity.getName();          se.type = type;          se.currentState = -1;          se.ttl = DEFAULT_TTL;          se.timestamp = new Date();          se.attrs = entity.getAttributes();          statusMap.put(se.name, se);          //updateLocations(new String[]{entity.getName()}, 0);          queueChangeEvent(            new CommunityStatusChangeEvent(CommunityStatusChangeEvent.MEMBERS_ADDED,                                           se.name,                                           se.type,                                           se.currentState,                                           -1,                                           se.currentLocation,                                           null,                                           null,                                           null));        }      }    }  }