try { RemoteListenable rl = remoteNode.getRemoteListenable(); if (rl != null) { rl.flushOutput(); remoteNode.destroy(); } } catch (Exception ex) { if(log.isWarnEnabled()) { log.warn("Unable to destroy node, assuming it's dead: ", ex); }   markNodeDead(nodeName); } }
RemoteListenable rl = null; for (int retries = 5; retries > 0; retries--) { try { rl = remoteNode.getRemoteListenable(); if (rl != null) { rl.flushOutput(); remoteNode.destroy(); retries = 0; }      } catch (Exception ex) {         if (rl == null) {      if (log.isWarnEnabled()) log.warn("Never got RemoteListenable. Exception possibly cause of load? Will pause and retry.", ex);   try {  sleep(2000); } catch (InterruptedException ie) {}  continue; } else {   if(log.isWarnEnabled()) { log.warn("Unable to destroy node, assuming it's dead: ", ex); }    markNodeDead(nodeName); retries = 0; } } } }
        public void run() {          RemoteProcess remoteNode;          synchronized (runningNodesLock) {            remoteNode = (RemoteProcess)runningNodes.get(nodeName);          } // end synchronized          if (remoteNode == null) {            if(log.isErrorEnabled()) {              log.error("Unknown node name: " + nodeName);            }	    markNodeDead(nodeName);            return;          }          try {            RemoteListenable rl =               remoteNode.getRemoteListenable();	    if (rl != null) {	      rl.flushOutput();	      remoteNode.destroy();	    }          } catch (Exception ex) {            if(log.isWarnEnabled()) {              log.warn("Unable to destroy node, assuming it's dead: ", ex);            }            // call the method that would have been called            // had the node been stopped	    markNodeDead(nodeName);          }        }