/** * 关闭Console */ private void shutdown() { isRunning = false; closeQuietly(socketWriter); closeQuietly(socketReader); closeQuietly(socket); console.shutdown(); }
/** * Use in testing when System.out, System.err or System.in change. * * @param systemIn The system in * @param systemOut The system out * @param systemErr The system err * @throws IOException if there is an error */ public void reinitialize(InputStream systemIn, PrintStream systemOut, PrintStream systemErr) throws IOException { if (reader != null) { reader.shutdown(); } initialize(systemIn, systemOut, systemErr); }
/** * Remove the Micronaut console. */ public static synchronized void removeInstance() { if (instance != null) { instance.removeShutdownHook(); instance.restoreOriginalSystemOutAndErr(); if (instance.getReader() != null) { instance.getReader().shutdown(); } instance = null; } }
public void shutdown() { if (reader != null) { reader.shutdown(); } if (accumuloClient != null) { accumuloClient.close(); } }
public void shutdown() { if (reader != null) { reader.shutdown(); } }
public void destroy() { if (reader != null) reader.shutdown(); thread.interrupt(); }
@VisibleForTesting public void close() { //for testcase if (client != null) { client.close(); } if (reader != null) { reader.shutdown(); } }
@VisibleForTesting public void close() { //for testcase if (client != null) { client.close(); } if (reader != null) { reader.shutdown(); } }
/** * Use in testing when System.out, System.err or System.in change * @throws IOException */ public void reinitialize(InputStream systemIn, PrintStream systemOut, PrintStream systemErr) throws IOException { if(reader != null) { reader.shutdown(); } initialize(systemIn, systemOut, systemErr); }
private void initConsoleReader() { try { this.consoleReader = new ConsoleReader("IzPack", new FileInputStream(FileDescriptor.in), System.out, null); this.consoleReader.setHandleUserInterrupt(true); Terminal terminal = consoleReader.getTerminal(); if (terminal == null || terminal instanceof UnsupportedTerminal) { consoleReader.shutdown(); throw new Throwable("Terminal not initialized"); } fileNameCompleter = new FileNameCompleter(); } catch (Throwable t) { logger.log(Level.WARNING, "Cannot initialize the console reader. Falling back to default console.", t); } }
@Override public void destroy() { ses.shutdownNow(); consoleReader.shutdown(); ThreadContext.unbindSubject(); ThreadContext.unbindSecurityManager(); }
@Override public void destroy() { ses.shutdownNow(); consoleReader.shutdown(); ThreadContext.unbindSubject(); ThreadContext.unbindSecurityManager(); }
} finally { System.out.println("!!!!!!!!!!!!!! UPDTED"); console.shutdown();
public static synchronized void removeInstance() { if (instance != null) { instance.removeShutdownHook(); instance.restoreOriginalSystemOutAndErr(); if(instance.getReader() != null) { instance.getReader().shutdown(); } instance = null; } }
public static void start_0() { try { ConsoleReader console = new ConsoleReader(); console.setPrompt("> "); while (true) { try { String line = console.readLine(); switch (line) { case "init:stop().": console.shutdown(); Init.stop(); break; default: if (!simple_call(line)) { throw new Error("Unsupported operation"); } } } catch (Error error) { System.err.println(error); } } } catch (IOException ioException) { ioException.printStackTrace(); } }
this.history.flush(); this.console.flush(); this.console.shutdown();
public void start(InputStream in, OutputStream out, LineReader lineReader, RP rp) throws Exception { consoleReader = new ConsoleReader(in, out, new TerminalSupport(true) { }); while (!halt) { try { String line = consoleReader.readLine(); (new Line(line)).sendEvent(this, lineReader); getMailbox().sendPendingMessages(); } catch (Exception ex) { break; } } consoleReader.shutdown(); }