Package software.amazon.awssdk.crt.http
Class HttpClientConnection
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.http.HttpClientConnection
-
- All Implemented Interfaces:
AutoCloseable
public class HttpClientConnection extends CrtResource
This class wraps aws-c-http to provide the basic HTTP request/response functionality via the AWS Common Runtime. HttpClientConnection represents a single connection to a HTTP service endpoint. This class is not thread safe and should not be called from different threads.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HttpClientConnection(long connectionBinding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.HttpStream
makeRequest(HttpRequest request, HttpStreamResponseHandler streamHandler)
Schedules an HttpRequest on the Native EventLoop for this HttpClientConnection.protected void
releaseNativeHandle()
Releases this HttpClientConnection back into the Connection Pool, and allows another Request to acquire this connection.void
shutdown()
Shuts down the underlying http connection.-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Method Detail
-
makeRequest
public HttpStream makeRequest(HttpRequest request, HttpStreamResponseHandler streamHandler) throws CrtRuntimeException
Schedules an HttpRequest on the Native EventLoop for this HttpClientConnection.- Parameters:
request
- The Request to make to the Server.streamHandler
- The Stream Handler to be called from the Native EventLoop- Returns:
- The HttpStream that represents this Request/Response Pair. It can be closed at any time during the request/response, but must be closed by the user thread making this request when it's done.
- Throws:
CrtRuntimeException
- if stream creation fails
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources that wait are responsible for calling releaseReferences() manually.- Specified by:
canReleaseReferencesImmediately
in classCrtResource
- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
releaseNativeHandle
protected void releaseNativeHandle()
Releases this HttpClientConnection back into the Connection Pool, and allows another Request to acquire this connection.- Specified by:
releaseNativeHandle
in classCrtResource
-
shutdown
public void shutdown()
Shuts down the underlying http connection. Even if this function is called, you still need to properly close the connection as well in order to release the native resources.
-
-