Skip to content

Commit 7e8905a

Browse files
Merge pull request #1 from waahm7/sync_crt
Synchronous CRT Http Client SPI with tests PR Feedback
2 parents b4e0a10 + 51e7926 commit 7e8905a

File tree

6 files changed

+6
-11
lines changed

6 files changed

+6
-11
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
8181
paramNotNull(asyncRequest.responseHandler(), "ResponseHandler");
8282

8383
asyncRequest.metricCollector()
84-
.filter(metricCollector -> !(metricCollector instanceof NoOpMetricCollector))
8584
.ifPresent(metricCollector -> metricCollector.reportMetric(HTTP_CLIENT_NAME, clientName()));
8685

8786
/*

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public String clientName() {
8080
@Override
8181
public ExecutableHttpRequest prepareRequest(HttpExecuteRequest request) {
8282
request.metricCollector()
83-
.filter(metricCollector -> !(metricCollector instanceof NoOpMetricCollector))
8483
.ifPresent(metricCollector -> metricCollector.reportMetric(HTTP_CLIENT_NAME, clientName()));
8584

8685
/*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public abstract class AwsCrtHttpClientBase implements SdkAutoCloseable {
6868

6969
protected AwsCrtHttpClientBase(AwsCrtClientBuilderBase builder, AttributeMap config) {
7070
if (config.get(PROTOCOL) == Protocol.HTTP2) {
71-
throw new UnsupportedOperationException("HTTP/2 is not supported in AwsCrtAsyncHttpClient yet. Use "
71+
throw new UnsupportedOperationException("HTTP/2 is not supported in AwsCrtHttpClient yet. Use "
7272
+ "NettyNioAsyncHttpClient instead.");
7373
}
7474

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,13 @@ public int onResponseBody(HttpStream stream, byte[] bodyBytesIn) {
272272

273273
CompletableFuture<Void> writeFuture = simplePublisher.send(ByteBuffer.wrap(bodyBytesIn));
274274

275-
// go ahead and let back pressure know we consumed the data.
276-
if (writeFuture.isDone() && !writeFuture.isCompletedExceptionally()) {
277-
return bodyBytesIn.length;
278-
}
279-
280275
writeFuture.whenComplete((result, failure) -> {
281276
if (failure != null) {
282277
requestCompletionFuture.completeExceptionally(failure);
283278
return;
284279
}
285280

286-
// otherwise, increment the window upon buffer consumption.
281+
// increment the window upon buffer consumption.
287282
stream.incrementWindow(bodyBytesIn.length);
288283
});
289284

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class CrtRequestInputStreamAdapter implements HttpRequestBodyStream {
2929
private static final int READ_BUFFER_SIZE = 16 * 1024;
3030

3131
private final ContentStreamProvider provider;
32-
private InputStream providerStream;
32+
private volatile InputStream providerStream;
3333
private final byte[] readBuffer = new byte[READ_BUFFER_SIZE];
3434

3535
CrtRequestInputStreamAdapter(ContentStreamProvider provider) {

test/sdk-benchmarks/src/main/java/software/amazon/awssdk/benchmark/BenchmarkRunner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import software.amazon.awssdk.benchmark.apicall.httpclient.async.NettyHttpClientH1Benchmark;
4343
import software.amazon.awssdk.benchmark.apicall.httpclient.async.NettyHttpClientH2Benchmark;
4444
import software.amazon.awssdk.benchmark.apicall.httpclient.sync.ApacheHttpClientBenchmark;
45+
import software.amazon.awssdk.benchmark.apicall.httpclient.sync.CrtHttpClientBenchmark;
4546
import software.amazon.awssdk.benchmark.apicall.httpclient.sync.UrlConnectionHttpClientBenchmark;
4647
import software.amazon.awssdk.benchmark.apicall.protocol.Ec2ProtocolBenchmark;
4748
import software.amazon.awssdk.benchmark.apicall.protocol.JsonProtocolBenchmark;
@@ -75,7 +76,8 @@ public class BenchmarkRunner {
7576

7677
private static final List<String> SYNC_BENCHMARKS = Arrays.asList(
7778
ApacheHttpClientBenchmark.class.getSimpleName(),
78-
UrlConnectionHttpClientBenchmark.class.getSimpleName());
79+
UrlConnectionHttpClientBenchmark.class.getSimpleName(),
80+
CrtHttpClientBenchmark.class.getSimpleName());
7981

8082
private static final List<String> COLD_START_BENCHMARKS = Arrays.asList(
8183
V2OptimizedClientCreationBenchmark.class.getSimpleName(),

0 commit comments

Comments
 (0)