diff --git a/http-clients/aws-crt-client/pom.xml b/http-clients/aws-crt-client/pom.xml
index c63e3082b4cd..9a8d5bf5ebc9 100644
--- a/http-clients/aws-crt-client/pom.xml
+++ b/http-clients/aws-crt-client/pom.xml
@@ -33,7 +33,7 @@
software.amazon.awssdk.crt
aws-crt
- 0.3.17
+ 0.3.19
diff --git a/http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtCombinatorialConfigStressIntegrationTest.java b/http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtClientCallingPatternIntegrationTest.java
similarity index 98%
rename from http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtCombinatorialConfigStressIntegrationTest.java
rename to http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtClientCallingPatternIntegrationTest.java
index f1abac977460..9fa269337d31 100644
--- a/http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtCombinatorialConfigStressIntegrationTest.java
+++ b/http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtClientCallingPatternIntegrationTest.java
@@ -40,8 +40,12 @@
import software.amazon.awssdk.services.kms.model.GenerateRandomResponse;
import software.amazon.awssdk.utils.AttributeMap;
+
+/**
+ * Test many possible different calling patterns that users might do, and make sure everything works.
+ */
@RunWith(Theories.class)
-public class AwsCrtCombinatorialConfigStressIntegrationTest {
+public class AwsCrtClientCallingPatternIntegrationTest {
private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
private final static Region REGION = Region.US_EAST_1;
private final static int DEFAULT_KEY_SIZE = 32;
@@ -87,8 +91,6 @@ private boolean testWithClient(KmsAsyncClient asyncKMSClient, int numberOfReques
failures.get(0).printStackTrace();
}
-
-
return succeeded;
}
diff --git a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java
index 8d037628620e..8a9647850d89 100644
--- a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java
+++ b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java
@@ -26,6 +26,7 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.crt.CrtResource;
import software.amazon.awssdk.crt.http.HttpConnectionPoolManager;
@@ -66,6 +67,7 @@ public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
private final Map connectionPools = new ConcurrentHashMap<>();
private final LinkedList ownedSubResources = new LinkedList<>();
+ private final AtomicBoolean isClosed = new AtomicBoolean(false);
private final ClientBootstrap bootstrap;
private final SocketOptions socketOptions;
private final TlsContextOptions tlsContextOptions;
@@ -208,6 +210,9 @@ private HttpRequest toCrtRequest(URI uri, AsyncExecuteRequest asyncRequest) {
@Override
public CompletableFuture execute(AsyncExecuteRequest asyncRequest) {
+ if (isClosed.get()) {
+ throw new IllegalStateException("Client is closed. No more requests can be made with this client.");
+ }
Validate.notNull(asyncRequest, "AsyncExecuteRequest must not be null");
Validate.notNull(asyncRequest.request(), "SdkHttpRequest must not be null");
Validate.notNull(asyncRequest.requestContentPublisher(), "RequestContentPublisher must not be null");
@@ -243,6 +248,7 @@ public CompletableFuture execute(AsyncExecuteRequest asyncRequest) {
@Override
public void close() {
+ isClosed.set(true);
for (HttpConnectionPoolManager connPool : connectionPools.values()) {
connPool.close();
}
diff --git a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtRequestBodySubscriber.java b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtRequestBodySubscriber.java
index 88c2ac408326..cbe7929fe3bd 100644
--- a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtRequestBodySubscriber.java
+++ b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtRequestBodySubscriber.java
@@ -99,8 +99,6 @@ public void onComplete() {
isComplete.set(true);
}
-
-
/**
* Transfers any queued data from the Request Body subscriptionRef to the output buffer
* @param out The output ByteBuffer
diff --git a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java
index 16c0b085777b..074fd0ff98a5 100644
--- a/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java
+++ b/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java
@@ -41,7 +41,6 @@ public class AwsCrtResponseBodyPublisher implements Publisher {
private static final Logger log = Logger.loggerFor(AwsCrtResponseBodyPublisher.class);
private static final LongUnaryOperator DECREMENT_IF_GREATER_THAN_ZERO = x -> ((x > 0) ? (x - 1) : (x));
-
private final HttpConnection connection;
private final HttpStream stream;
private final CompletableFuture responseComplete;