Skip to content

Commit

Permalink
Address Code Review Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexw91 authored and millems committed Sep 9, 2019
1 parent 7d02a4c commit 326c0e0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion http-clients/aws-crt-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<version>0.3.17</version>
<version>0.3.19</version>
</dependency>

<!--SDK dependencies-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,8 +91,6 @@ private boolean testWithClient(KmsAsyncClient asyncKMSClient, int numberOfReques
failures.get(0).printStackTrace();
}



return succeeded;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,6 +67,7 @@ public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {

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

@Override
public CompletableFuture<Void> 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");
Expand Down Expand Up @@ -243,6 +248,7 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {

@Override
public void close() {
isClosed.set(true);
for (HttpConnectionPoolManager connPool : connectionPools.values()) {
connPool.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class AwsCrtResponseBodyPublisher implements Publisher<ByteBuffer> {
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<Void> responseComplete;
Expand Down

0 comments on commit 326c0e0

Please sign in to comment.