String nodeName = nodeComponent.getShortName();
  private void stopAllNodes() {    // if there's a thread still creating nodes, stop it    stopNodeCreation = true;    // wait for the creating thread to stop    if (nodeCreator != null) {      try {        nodeCreator.join();      } catch (InterruptedException ie) {        if(log.isErrorEnabled()) {          log.error("Exception waiting for node creation thread to die: ", ie);        }      }      nodeCreator = null;    }    // at this point all the nodes have been created, but    // the gui controls for the last node created may not have    // been created (as they're created via a swing-thread-invoke-later)    // so we can no longer assume that a gui (node frame, status button)    // exists for every node    // set a flag indicating that we're stopping the trial    stopping = true;    Enumeration nodeComponents;    synchronized (runningNodesLock) {      nodeComponents = runningNodes.keys();    } // end synchronized    // before destroying nodes, stop the GLSClient so    // we don't get error messages    if (glsClient != null)       glsClient.stop();    while (nodeComponents.hasMoreElements()) {      NodeComponent nodeComponent =         (NodeComponent)nodeComponents.nextElement();      RemoteProcess remoteNode;      synchronized (runningNodesLock) {        remoteNode = (RemoteProcess)runningNodes.get(nodeComponent);      } // end synchronized      String nodeName = nodeComponent.getShortName();      if (remoteNode == null) {        if(log.isErrorEnabled()) {          log.error("Unknown node name: " + nodeName);        }        continue;      }      try {        remoteNode.getRemoteListenable().flushOutput();        remoteNode.destroy();      } catch (Exception ex) {        if(log.isErrorEnabled()) {          log.error("Unable to destroy node, assuming it's dead: ", ex);        }        nodeStopped(nodeComponent);        getNodeStatusButton(nodeComponent.getShortName()).setStatus(NodeStatusButton.STATUS_NO_ANSWER);      }    }  }