blockUntilQueueFree(feedableBodyGenerator.context.getConnection()); final HttpContent content = feedableBodyGenerator.contentBuilder.content(buffer).last(last).build();
blockUntilQueueFree(feedableBodyGenerator.context.getConnection()); final HttpContent content = feedableBodyGenerator.contentBuilder.content(buffer).last(last).build();
blockUntilQueueFree(feedableBodyGenerator.context.getConnection()); final HttpContent content = feedableBodyGenerator.contentBuilder.content(buffer).last(last).build();
/** * This method will block if the async write queue is currently larger * than the configured maximum. The amount of time that this method * will block is dependent on the write timeout of the transport * associated with the specified connection. */ private static void blockUntilQueueFree(final Connection c) { if (!c.canWrite()) { final FutureImpl<Boolean> future = Futures.createSafeFuture(); // Connection may be obtained by calling FilterChainContext.getConnection(). c.notifyCanWrite(new WriteHandler() { @Override public void onWritePossible() throws Exception { future.result(TRUE); } @Override public void onError(Throwable t) { future.failure(makeIOException(t)); } }); block(c, future); } }
/** * This method will block if the async write queue is currently larger * than the configured maximum. The amount of time that this method * will block is dependent on the write timeout of the transport * associated with the specified connection. */ private static void blockUntilQueueFree(final Connection c) { if (!c.canWrite()) { final FutureImpl<Boolean> future = Futures.createSafeFuture(); // Connection may be obtained by calling FilterChainContext.getConnection(). c.notifyCanWrite(new WriteHandler() { @Override public void onWritePossible() throws Exception { future.result(TRUE); } @Override public void onError(Throwable t) { future.failure(makeIOException(t)); } }); block(c, future); } }
/** * This method will block if the async write queue is currently larger * than the configured maximum. The amount of time that this method * will block is dependent on the write timeout of the transport * associated with the specified connection. */ private static void blockUntilQueueFree(final Connection c) { if (!c.canWrite()) { final FutureImpl<Boolean> future = Futures.createSafeFuture(); // Connection may be obtained by calling FilterChainContext.getConnection(). c.notifyCanWrite(new WriteHandler() { @Override public void onWritePossible() throws Exception { future.result(TRUE); } @Override public void onError(Throwable t) { future.failure(makeIOException(t)); } }); block(c, future); } }
@SuppressWarnings("UnusedDeclaration") @Override public final synchronized void feed(final Buffer buffer, final boolean last) throws IOException { if (buffer == null) { throw new IllegalArgumentException( "Buffer argument cannot be null."); } if (!feedableBodyGenerator.asyncTransferInitiated) { throw new IllegalStateException("Asynchronous transfer has not been initiated."); } blockUntilQueueFree(feedableBodyGenerator.context.getConnection()); final HttpContent content = feedableBodyGenerator.contentBuilder.content(buffer).last(last).build(); final CompletionHandler<WriteResult> handler = ((last) ? new LastPacketCompletionHandler() : null); feedableBodyGenerator.context.write(content, handler); }
/** * This method will block if the async write queue is currently larger * than the configured maximum. The amount of time that this method * will block is dependent on the write timeout of the transport * associated with the specified connection. */ private static void blockUntilQueueFree(final Connection c) { if (!c.canWrite()) { final FutureImpl<Boolean> future = Futures.createSafeFuture(); // Connection may be obtained by calling FilterChainContext.getConnection(). c.notifyCanWrite(new WriteHandler() { @Override public void onWritePossible() throws Exception { future.result(TRUE); } @Override public void onError(Throwable t) { future.failure(makeIOException(t)); } }); block(c, future); } }