Set processNames = nodeToAppServer.keySet(); if (processNames.size() == 0) return null; ArrayList results = new ArrayList(); String[] attachToNodes = getNodesToAttach(new ArrayList(processNames)); for (int i = 0; i < attachToNodes.length; i++) { String processName = attachToNodes[i]; AppServerDesc desc = (AppServerDesc)nodeToAppServer.get(processName); RemoteHost appServer = desc.appServer; ProcessDescription pd = null; try { pd = appServer.getProcessDescription(processName); } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Exception attaching to: " + processName, e); } continue; } Properties properties = (Properties)pd.getJavaProperties(); String nodeName = (String)properties.get("org.cougaar.node.name"); String hostName = (String)properties.get("org.cougaar.name.server"); java.util.List args = pd.getCommandLineArguments(); results.add(new NodeInfo(appServer, nodeName, hostName, processName, properties, args)); } return results;
  public synchronized ArrayList getNodesToAttach() {    if (appServers.size() == 0)      return null;    Set processNames = nodeToAppServer.keySet();    if (processNames.size() == 0)      return null;    ArrayList results = new ArrayList();    String[] attachToNodes = getNodesToAttach(new ArrayList(processNames));    for (int i = 0; i < attachToNodes.length; i++) {      String processName = attachToNodes[i];      AppServerDesc desc = (AppServerDesc)nodeToAppServer.get(processName);      RemoteHost appServer = desc.appServer;      ProcessDescription pd = null;      try {        pd = appServer.getProcessDescription(processName);      } catch (Exception e) {        if (log.isErrorEnabled()) {          log.error("Exception attaching to: " + processName, e);        }        continue;      }      Properties properties = (Properties)pd.getJavaProperties();      String nodeName = (String)properties.get("org.cougaar.node.name");      String hostName = (String)properties.get("org.cougaar.name.server");      java.util.List args = pd.getCommandLineArguments();      results.add(new NodeInfo(appServer, nodeName, hostName,                               processName,                               properties, args));    }    return results;  }