Skip to content

Commit 326c0e0

Browse files
alexw91millems
authored andcommitted
Address Code Review Feedback
1 parent 7d02a4c commit 326c0e0

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

http-clients/aws-crt-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<dependency>
3434
<groupId>software.amazon.awssdk.crt</groupId>
3535
<artifactId>aws-crt</artifactId>
36-
<version>0.3.17</version>
36+
<version>0.3.19</version>
3737
</dependency>
3838

3939
<!--SDK dependencies-->
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@
4040
import software.amazon.awssdk.services.kms.model.GenerateRandomResponse;
4141
import software.amazon.awssdk.utils.AttributeMap;
4242

43+
44+
/**
45+
* Test many possible different calling patterns that users might do, and make sure everything works.
46+
*/
4347
@RunWith(Theories.class)
44-
public class AwsCrtCombinatorialConfigStressIntegrationTest {
48+
public class AwsCrtClientCallingPatternIntegrationTest {
4549
private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
4650
private final static Region REGION = Region.US_EAST_1;
4751
private final static int DEFAULT_KEY_SIZE = 32;
@@ -87,8 +91,6 @@ private boolean testWithClient(KmsAsyncClient asyncKMSClient, int numberOfReques
8791
failures.get(0).printStackTrace();
8892
}
8993

90-
91-
9294
return succeeded;
9395
}
9496

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Optional;
2727
import java.util.concurrent.CompletableFuture;
2828
import java.util.concurrent.ConcurrentHashMap;
29+
import java.util.concurrent.atomic.AtomicBoolean;
2930
import software.amazon.awssdk.annotations.SdkPublicApi;
3031
import software.amazon.awssdk.crt.CrtResource;
3132
import software.amazon.awssdk.crt.http.HttpConnectionPoolManager;
@@ -66,6 +67,7 @@ public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
6667

6768
private final Map<URI, HttpConnectionPoolManager> connectionPools = new ConcurrentHashMap<>();
6869
private final LinkedList<CrtResource> ownedSubResources = new LinkedList<>();
70+
private final AtomicBoolean isClosed = new AtomicBoolean(false);
6971
private final ClientBootstrap bootstrap;
7072
private final SocketOptions socketOptions;
7173
private final TlsContextOptions tlsContextOptions;
@@ -208,6 +210,9 @@ private HttpRequest toCrtRequest(URI uri, AsyncExecuteRequest asyncRequest) {
208210

209211
@Override
210212
public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
213+
if (isClosed.get()) {
214+
throw new IllegalStateException("Client is closed. No more requests can be made with this client.");
215+
}
211216
Validate.notNull(asyncRequest, "AsyncExecuteRequest must not be null");
212217
Validate.notNull(asyncRequest.request(), "SdkHttpRequest must not be null");
213218
Validate.notNull(asyncRequest.requestContentPublisher(), "RequestContentPublisher must not be null");
@@ -243,6 +248,7 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
243248

244249
@Override
245250
public void close() {
251+
isClosed.set(true);
246252
for (HttpConnectionPoolManager connPool : connectionPools.values()) {
247253
connPool.close();
248254
}

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtRequestBodySubscriber.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ public void onComplete() {
9999
isComplete.set(true);
100100
}
101101

102-
103-
104102
/**
105103
* Transfers any queued data from the Request Body subscriptionRef to the output buffer
106104
* @param out The output ByteBuffer

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public class AwsCrtResponseBodyPublisher implements Publisher<ByteBuffer> {
4141
private static final Logger log = Logger.loggerFor(AwsCrtResponseBodyPublisher.class);
4242
private static final LongUnaryOperator DECREMENT_IF_GREATER_THAN_ZERO = x -> ((x > 0) ? (x - 1) : (x));
4343

44-
4544
private final HttpConnection connection;
4645
private final HttpStream stream;
4746
private final CompletableFuture<Void> responseComplete;

0 commit comments

Comments
 (0)