/** * Blocking send of channel content. * * @param in The channel content to send * @throws IOException if the send fails */ public void sendContent(ReadableByteChannel in) throws IOException { try (Blocker blocker = _writeBlock.acquire()) { new ReadableByteChannelWritingCB(in, blocker).iterate(); blocker.block(); } catch (Throwable failure) { if (LOG.isDebugEnabled()) LOG.debug(failure); abort(failure); throw failure; } }
/** * Blocking send of HTTP content. * * @param content The HTTP content to send * @throws IOException if the send fails */ public void sendContent(HttpContent content) throws IOException { try (Blocker blocker = _writeBlock.acquire()) { sendContent(content, blocker); blocker.block(); } catch (Throwable failure) { if (LOG.isDebugEnabled()) LOG.debug(failure); abort(failure); throw failure; } }
private void write(ByteBuffer content, boolean complete) throws IOException { try (Blocker blocker = _writeBlock.acquire()) { write(content, complete, blocker); blocker.block(); } catch (Exception failure) { if (LOG.isDebugEnabled()) LOG.debug(failure); abort(failure); if (failure instanceof IOException) throw failure; throw new IOException(failure); } }