if (logger.isDebugEnabled()) { logger.debug("New agent detected: agent=" + agent);
if (logger.isInfoEnabled()) { logger.info("New agent detected: agent=" + agent); } } } for (Iterator it = agentVersions.keySet().iterator(); it.hasNext(); ) { MessageAddress agentAddr = MessageAddress.getMessageAddress(it.next().toString()); if (!ncs.getRootContainer().containsAgent(agentAddr)) {  it.remove(); if (logger.isInfoEnabled()) { logger.info("Agent removed: agent=" + agentAddr.toString());
  private Set listLocalAgents() {    Set names = new HashSet();    NodeControlService ncs = getNodeControlService();    if (ncs != null) {      Set agentAddresses = ncs.getRootContainer().getAgentAddresses();      for (Iterator it = agentAddresses.iterator(); it.hasNext(); ) {        String agent = it.next().toString();        names.add(agent);        if (!agentVersions.containsKey(agent)) {          agentVersions.put(agent, new Long(now()));          if (logger.isDebugEnabled()) {            logger.debug("New agent detected: agent=" + agent);          }        }      }    }    return names;  }