@Override public String readLine(String msg, boolean echo) throws IOException, InterruptedException { Reader waiter = new Reader(Thread.currentThread(), echo); if (editor.compareAndSet(null, waiter)) { if (msg != null && msg.length() > 0) { console.driver.write(msg); console.driver.flush(); } console.iterate(); try { return waiter.line.take(); } finally { editor.set(null); } } else { throw new IllegalStateException("A thread is already reading the line"); } }
public void on(KeyStroke keyStroke) { // if (keyStroke.operation == Operation.INTERRUPT) { Plugin current = handler.get(); if (current == null) { throw new IllegalStateException("Not initialized"); } else if (current instanceof ProcessHandler) { ProcessHandler processHandler = (ProcessHandler)current; ProcessHandler.Reader reader = processHandler.editor.get(); if (reader != null) { reader.thread.interrupt(); } processHandler.process.cancel(); return; } } buffer.add(keyStroke); // iterate(); // This was modified by this thread during the loop if (status == CLOSING) { status = CLOSED; Utils.close(driver); } }
console.iterate();
@Override public String readLine(String msg, boolean echo) throws IOException, InterruptedException { Reader waiter = new Reader(Thread.currentThread(), echo); if (editor.compareAndSet(null, waiter)) { if (msg != null && msg.length() > 0) { console.driver.write(msg); console.driver.flush(); } console.iterate(); try { return waiter.line.take(); } finally { editor.set(null); } } else { throw new IllegalStateException("A thread is already reading the line"); } }
@Override public String readLine(String msg, boolean echo) throws IOException, InterruptedException { Reader waiter = new Reader(Thread.currentThread(), echo); if (editor.compareAndSet(null, waiter)) { if (msg != null && msg.length() > 0) { console.driver.write(msg); console.driver.flush(); } console.iterate(); try { return waiter.line.take(); } finally { editor.set(null); } } else { throw new IllegalStateException("A thread is already reading the line"); } }
public void on(KeyStroke keyStroke) { // if (keyStroke.operation == Operation.INTERRUPT) { Plugin current = handler.get(); if (current == null) { throw new IllegalStateException("Not initialized"); } else if (current instanceof ProcessHandler) { ProcessHandler processHandler = (ProcessHandler)current; ProcessHandler.Reader reader = processHandler.editor.get(); if (reader != null) { reader.thread.interrupt(); } processHandler.process.cancel(); return; } } buffer.add(keyStroke); // iterate(); // This was modified by this thread during the loop if (status == CLOSING) { status = CLOSED; Utils.close(driver); } }
public void on(KeyStroke keyStroke) { // if (keyStroke.operation == Operation.INTERRUPT) { Plugin current = handler.get(); if (current == null) { throw new IllegalStateException("Not initialized"); } else if (current instanceof ProcessHandler) { ProcessHandler processHandler = (ProcessHandler)current; ProcessHandler.Reader reader = processHandler.editor.get(); if (reader != null) { reader.thread.interrupt(); } processHandler.process.cancel(); return; } } buffer.add(keyStroke); // iterate(); // This was modified by this thread during the loop if (status == CLOSING) { status = CLOSED; Utils.close(driver); } }
console.iterate();