Class Http1StreamManager
- All Implemented Interfaces:
AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionacquireStream(HttpRequestBase request, HttpStreamBaseResponseHandler streamHandler) Request an HTTP/1.1 HttpStream from StreamManager.acquireStream(HttpRequestBase request, HttpStreamBaseResponseHandler streamHandler, boolean useManualDataWrites) Request an HTTP/1.1 HttpStream from StreamManager.acquireStream(HttpRequest request, HttpStreamBaseResponseHandler streamHandler) Request an HTTP/1.1 HttpStream from StreamManager.acquireStream(HttpRequest request, HttpStreamBaseResponseHandler streamHandler, boolean useManualDataWrites) Request an HTTP/1.1 HttpStream from StreamManager.voidclose()static Http1StreamManagercreate(HttpClientConnectionManagerOptions options) Factory function for Http1StreamManager instancesint
-
Method Details
-
create
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
-
getShutdownCompleteFuture
-
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(HttpRequest request, HttpStreamBaseResponseHandler streamHandler, boolean useManualDataWrites) 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 EventLoopuseManualDataWrites- A boolean variable to signal that body will be streamed using async writes.- 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.
-
acquireStream
public CompletableFuture<HttpStream> acquireStream(HttpRequestBase request, HttpStreamBaseResponseHandler streamHandler, boolean useManualDataWrites) Request an HTTP/1.1 HttpStream from StreamManager.The returned future completes with an
HttpStreamthat will be activated immediately after the future is completed. The stream's response callbacks (onResponseHeaders, etc.) may begin firing as soon as activate is called.Important: Operations on the stream (such as
cancel()) must only be invoked afteractivate()has been called. Ifcancel()is called before activate, it is a no-op — the stream will still proceed normally once activate runs, which may lead to unexpected behavior. Since there is a brief window between future completion and activation, callers that need to perform operations on the stream (from a future callback such asthenAcceptorwhenComplete) should callstream.activate()first.activate()is idempotent — calling it multiple times is safe and has no effect after the first successful call.- Parameters:
request- HttpRequestBase. The Request to make to the Server.streamHandler- HttpStreamBaseResponseHandler. The Stream Handler to be called from the Native EventLoopuseManualDataWrites- A boolean variable to signal that body will be streamed using async writes.- Returns:
- A future for a HttpStream that will be completed when the stream is acquired and will be activated immediately after.
- Throws:
CrtRuntimeException- Exception happens from acquiring stream.
-
getManagerMetrics
- Returns:
- concurrency metrics for the current manager
-
getMaxConnections
public int getMaxConnections()- Returns:
- maximum number of connections this manager will pool
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-