@Override public final void run() { final Locus locus = context.getLocus(); final Bundle bundle = context.getBundle(); final Alerts alerts = context.getAlerts(); final File file = context.getFile(); final String href = context.getHref(); try { logger.entering(getClass().getName(), Runnable.class.getName()); script.start(); runInner(); } catch (IOException e) { alerts.add(new Alert(Alert.Severity.ERR, e.getMessage(), e.getClass().getSimpleName())); } finally { script.finish(); } try { new ScriptWriter(script, locus).writeTo(file); new AlertWriter(bundle, alerts).write("command.finished", "results.view", href); } catch (IOException e) { alerts.add(new Alert(Alert.Severity.ERR, e.getMessage())); } finally { logger.exiting(getClass().getName(), Runnable.class.getName()); } }
private void runCommand(final CommandToDo commandToDo, final Session session) throws IOException { final CommandWork commandWork = script.startCommand(commandToDo, UTF8Codec.Const.UTF8, null); Integer exitValue = null; try { session.execCommand(commandWork.getStdin()); exitValue = monitorCommand(commandWork, session); } catch (IOException e) { commandWork.getByteBufferStderr().addString(e.getMessage()); } finally { script.finishCommand(commandWork, exitValue); context.getSSHConnection().update(commandWork.getStart()); } }
@SuppressWarnings("PMD.AssignmentInOperand") private void runInner() throws IOException { CommandToDo command; while ((command = script.getCommandToDo()) != null) { runCommand(command); } MutexU.notifyAll(this); }