public void cancel() { // Construcuted -> ISE // Evaluating -> Canceled // Queued -> Canceled // Cancelled -> Cancelled // Terminated -> Terminated boolean cancel; synchronized (lock) { switch (status) { case CONSTRUCTED: throw new IllegalStateException( "Cannot call cancel on process that was not scheduled for execution yet"); case QUEUED: status = Status.CANCELED; cancel = false; break; case EVALUATING: status = Status.CANCELED; cancel = true; break; default: cancel = false; break; } } // if (cancel) { callee.cancel(); } }
public void cancel() { ShellProcess process = current.get(); if (process != null) { process.cancel(); } else { writer.println(); writer.print(getPrompt()); writer.flush(); } }