Class Http1StreamManager

  • All Implemented Interfaces:
    AutoCloseable

    public class Http1StreamManager
    extends Object
    implements AutoCloseable
    Manages a Pool of HTTP/1.1 Streams. Creates and manages HTTP/1.1 connections under the hood. Will grab a connection from HttpClientConnectionManager to make request on it, and will return it back until the request finishes.
    • Method Detail

      • create

        public static Http1StreamManager create​(HttpClientConnectionManagerOptions options)
        Factory function for Http1StreamManager instances
        Parameters:
        options - the connection manager options configure to connection manager under the hood
        Returns:
        a new instance of an Http1StreamManager
      • acquireStream

        public CompletableFuture<HttpStream> acquireStream​(HttpRequest request,
                                                           HttpStreamBaseResponseHandler streamHandler)
        Request an HTTP/1.1 HttpStream from StreamManager.
        Parameters:
        request - HttpRequest. The Request to make to the Server.
        streamHandler - HttpStreamBaseResponseHandler. The Stream Handler to be called from the Native EventLoop
        Returns:
        A future for a HttpStream that will be completed when the stream is acquired.
        Throws:
        CrtRuntimeException - Exception happens from acquiring stream.
      • acquireStream

        public CompletableFuture<HttpStream> acquireStream​(HttpRequestBase request,
                                                           HttpStreamBaseResponseHandler streamHandler)
        Request an HTTP/1.1 HttpStream from StreamManager.
        Parameters:
        request - HttpRequestBase. The Request to make to the Server.
        streamHandler - HttpStreamBaseResponseHandler. The Stream Handler to be called from the Native EventLoop
        Returns:
        A future for a HttpStream that will be completed when the stream is acquired.
        Throws:
        CrtRuntimeException - Exception happens from acquiring stream.
      • getManagerMetrics

        public HttpManagerMetrics getManagerMetrics()
        Returns:
        concurrency metrics for the current manager
      • getMaxConnections

        public int getMaxConnections()
        Returns:
        maximum number of connections this manager will pool