@Override protected CompletableFuture<Optional<Object>> send(final Optional<Object> id, final byte[] data) { synchronized (this) { CompletableFuture<Optional<Object>> future = new CompletableFuture<>(); try { out.write(data); out.flush(); future.complete(id); } catch (Throwable ex) { future.completeExceptionally(ex); ifClose(ex); } return future; } }
private void invoke(ServiceRequestContext ctx, HttpResponseWriter res, ArmeriaHttpTransport transport, HttpChannel httpChannel) { final Queue<HttpData> out = transport.out; try { server.handle(httpChannel); httpChannel.getResponse().getHttpOutput().flush(); final Throwable cause = transport.cause; if (cause != null) { throw cause; } final HttpHeaders headers = toResponseHeaders(transport); if (res.tryWrite(headers)) { for (;;) { final HttpData data = out.poll(); if (data == null || !res.tryWrite(data)) { break; } } } } catch (Throwable t) { logger.warn("{} Failed to produce a response:", ctx, t); } finally { res.close(); } }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flush() throws IOException { _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flushBuffer() throws IOException { if (!_out.isClosed()) _out.flush(); }
@Override public void flush() throws IOException { if (!super._generator.isCommitted()) commitResponse(Generator.MORE); super.flush(); }
@Override public void flush() throws IOException { if (!super._generator.isCommitted()) commitResponse(Generator.MORE); super.flush(); }
@Override public void flush() throws IOException { if (!super._generator.isCommitted()) commitResponse(Generator.MORE); super.flush(); }
@Override public void flush() throws IOException { if (!super._generator.isCommitted()) commitResponse(Generator.MORE); super.flush(); }
@Override public void flush() throws IOException { if (!super._generator.isCommitted()) commitResponse(Generator.MORE); super.flush(); }