Class NettyResponseBodyControl

    • Method Detail

      • discardForChannelClose

        public static void discardForChannelClose​(NettyResponseFuture<?> future,
                                                  io.netty.channel.Channel channel)
      • isSuspended

        public static boolean isSuspended​(NettyResponseFuture<?> future)
        Returns whether response reads for future are suspended by its current response body control.
      • isSuspended

        public static boolean isSuspended​(NettyResponseFuture<?> future,
                                          io.netty.channel.Channel channel)
        Returns whether future is suspended on channel.
      • markBodyFullyRead

        public static void markBodyFullyRead​(NettyResponseFuture<?> future)
        Records that the complete HTTP/1.1 response has reached the client before its terminal callbacks run.
      • suspend

        public void suspend()
        Description copied from interface: ResponseBodyControl
        Stops requesting additional response bytes from the transport. Body parts that were already read may still be delivered to the AsyncHandler. If the final response headers already ended the response, this call has no effect on completion.

        While reads are suspended, the read timeout is paused but the request timeout remains active. If the request timeout is disabled, failing to resume or cancel the response can retain its transport resources indefinitely.

        For HTTP/2, while any response on a connection is suspended, AHC continues returning connection-level flow-control credit so a suspended stream cannot block sibling streams. Responses on connections with no active suspension retain the normal shared connection-window bound. The per-stream window always applies, so roughly AsyncHttpClientConfig.getHttp2InitialWindowSize() bytes can be queued for each suspended stream. Aggregate buffering during suspension can therefore scale with the number of concurrent streams. Once the last suspension ends, normal connection accounting resumes; credit already returned and data already queued cannot be revoked. Applications can bound buffering with AsyncHttpClientConfig.getHttp2InitialWindowSize() and AsyncHttpClientConfig.getHttp2MaxConcurrentStreams().

        Specified by:
        suspend in interface ResponseBodyControl
      • cancel

        public void cancel()
        Description copied from interface: ResponseBodyControl
        Stops processing the response body. As with AsyncHandler.State.ABORT, the handler is completed normally. Returning ABORT is the preferred way to stop from within an AsyncHandler callback; this method is intended for cancellation after the callback has returned, including from another thread.
        Specified by:
        cancel in interface ResponseBodyControl