@Override public void close() { client.close(); }
private void renderResults(PrintStream out, OutputFormat outputFormat, boolean interactive, List<Column> columns) { try { doRenderResults(out, outputFormat, interactive, columns); } catch (QueryAbortedException e) { System.out.println("(query aborted by user)"); client.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }
public boolean renderOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { Thread clientThread = Thread.currentThread(); SignalHandler oldHandler = Signal.handle(SIGINT, signal -> { if (ignoreUserInterrupt.get() || client.isClientAborted()) { return; } client.close(); clientThread.interrupt(); }); try { return renderQueryOutput(out, outputFormat, interactive); } finally { Signal.handle(SIGINT, oldHandler); Thread.interrupted(); // clear interrupt status } }
private void pageOutput(OutputFormat format, List<String> fieldNames) throws IOException { try (Pager pager = Pager.create(); ThreadInterruptor clientThread = new ThreadInterruptor(); Writer writer = createWriter(pager); OutputHandler handler = createOutputHandler(format, writer, fieldNames)) { if (!pager.isNullPager()) { // ignore the user pressing ctrl-C while in the pager ignoreUserInterrupt.set(true); pager.getFinishFuture().thenRun(() -> { ignoreUserInterrupt.set(false); client.close(); clientThread.interrupt(); }); } handler.processRows(client); } catch (RuntimeException | IOException e) { if (client.isClientAborted() && !(e instanceof QueryAbortedException)) { throw new QueryAbortedException(e); } throw e; } }
updateScreen(warningsPrinter); update = false; client.close();
@Override public void kill() { if (!update) { client.close(); } }
private void waitForQuery() { while (client.isValid()) { if (Thread.currentThread().isInterrupted()) { client.close(); throw new RakamException("Query executor thread was interrupted", INTERNAL_SERVER_ERROR); } transformAndAdd(); client.advance(); } }
@Override public void close() { client.close(); }
@Override public void close() { client.close(); }
private void renderResults(PrintStream out, OutputFormat outputFormat, boolean interactive, List<Column> columns) { try { doRenderResults(out, outputFormat, interactive, columns); } catch (QueryAbortedException e) { System.out.println("(query aborted by user)"); client.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }
private void renderResults(PrintStream out, OutputFormat outputFormat, boolean interactive, List<Column> columns) { try { doRenderResults(out, outputFormat, interactive, columns); } catch (QueryAbortedException e) { System.out.println("(query aborted by user)"); client.close(); } catch (IOException e) { throw Throwables.propagate(e); } }
public void renderOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { Thread clientThread = Thread.currentThread(); SignalHandler oldHandler = Signal.handle(SIGINT, signal -> { if (ignoreUserInterrupt.get() || client.isClosed()) { return; } userAbortedQuery.set(true); client.close(); clientThread.interrupt(); }); try { renderQueryOutput(out, outputFormat, interactive); } finally { Signal.handle(SIGINT, oldHandler); Thread.interrupted(); // clear interrupt status } }
public boolean renderOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { Thread clientThread = Thread.currentThread(); SignalHandler oldHandler = Signal.handle(SIGINT, signal -> { if (ignoreUserInterrupt.get() || client.isClientAborted()) { return; } client.close(); clientThread.interrupt(); }); try { return renderQueryOutput(out, outputFormat, interactive); } finally { Signal.handle(SIGINT, oldHandler); Thread.interrupted(); // clear interrupt status } }
updateScreen(); update = false; client.close();
private void pageOutput(OutputFormat format, List<String> fieldNames) throws IOException { try (Pager pager = Pager.create(); ThreadInterruptor clientThread = new ThreadInterruptor(); Writer writer = createWriter(pager); OutputHandler handler = createOutputHandler(format, writer, fieldNames)) { if (!pager.isNullPager()) { // ignore the user pressing ctrl-C while in the pager ignoreUserInterrupt.set(true); pager.getFinishFuture().thenRun(() -> { ignoreUserInterrupt.set(false); client.close(); clientThread.interrupt(); }); } handler.processRows(client); } catch (RuntimeException | IOException e) { if (client.isClientAborted() && !(e instanceof QueryAbortedException)) { throw new QueryAbortedException(e); } throw e; } }
updateScreen(warningsPrinter); update = false; client.close();