appServerSupport.killListeners();
dontClose = false;   boolean justExit = false; synchronized (runningNodesLock) { if (runningNodes.isEmpty()) justExit = true; }  if (! justExit) { JPanel exitPanel = new JPanel(new GridBagLayout()); int x = 0; int y = 0; JLabel instr = new JLabel("Exit Console: Detach from Nodes (leaving them running), kill the Nodes, or Cancel?\n"); JRadioButton detachButton = new JRadioButton("Detach from Society but leave running (default)"); JRadioButton killButton = new JRadioButton("Stop all Attached Nodes (old behavior)"); detachButton.setSelected(true); killButton.setSelected(false);  ButtonGroup exitButtonGroup = new ButtonGroup(); exitButtonGroup.add(detachButton); exitButtonGroup.add(killButton);  exitPanel.add(instr, new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 5, 5), 0, 0)); exitPanel.add(detachButton, new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 5, 5), 0, 0)); exitPanel.add(killButton, new GridBagConstraints(x, y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));  int result = JOptionPane.showConfirmDialog(null, exitPanel, "Exit Console", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null); if (result == JOptionPane.CANCEL_OPTION) {   dontClose = true; return; }  if (killButton.isSelected()) { abortButton_actionPerformed();   } else {   appServerSupport.killListeners(); updateControls(false); } }
  private void exitMenuItem_actionPerformed(AWTEvent e) {    // don't stop experiments when exiting the console    //    stopExperiments();    // kill any node output listeners that this instance of CSMART started    appServerSupport.killListeners();    // Stop polling the Appservers    if (asPollTimer != null) {      if (log.isDebugEnabled()) {	log.debug("Canceling old AS timer");      }      asPollTimer.cancel();      // stop monitoring app servers      monitorAppServerTask.cancel();    }    updateControls(false);    // this is set when entering the console and must be cleared on exit    if (experiment != null)      experiment.setRunInProgress(false);        // If this was this frame's exit menu item, we have to remove    // the window from the list    // if it was a WindowClose, the parent notices this as well    if (e instanceof ActionEvent)      NamedFrame.getNamedFrame().removeFrame(this);    dispose();  }