Skip to content

Commit b1d0e17

Browse files
committed
Small HTTP SPI cleanups.
1 parent ece85ec commit b1d0e17

File tree

23 files changed

+55
-128
lines changed

23 files changed

+55
-128
lines changed

core/sdk-core/src/it/java/software/amazon/awssdk/core/http/timers/client/AbortedExceptionClientExecutionTimerIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import software.amazon.awssdk.core.exception.AbortedException;
3030
import software.amazon.awssdk.core.exception.ApiCallTimeoutException;
3131
import software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient;
32-
import software.amazon.awssdk.http.AbortableCallable;
32+
import software.amazon.awssdk.http.InvokeableHttpRequest;
3333
import software.amazon.awssdk.http.SdkHttpClient;
3434
import software.amazon.awssdk.http.SdkHttpFullResponse;
3535
import utils.HttpTestUtils;
@@ -43,7 +43,7 @@ public class AbortedExceptionClientExecutionTimerIntegrationTest {
4343
private SdkHttpClient sdkHttpClient;
4444

4545
@Mock
46-
private AbortableCallable<SdkHttpFullResponse> abortableCallable;
46+
private InvokeableHttpRequest abortableCallable;
4747

4848
@Before
4949
public void setup() throws Exception {

core/sdk-core/src/main/java/software/amazon/awssdk/core/client/builder/SdkDefaultClientBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@
5555
import software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder;
5656
import software.amazon.awssdk.core.internal.util.UserAgentUtils;
5757
import software.amazon.awssdk.core.retry.RetryPolicy;
58-
import software.amazon.awssdk.http.AbortableCallable;
5958
import software.amazon.awssdk.http.ExecuteRequest;
59+
import software.amazon.awssdk.http.InvokeableHttpRequest;
6060
import software.amazon.awssdk.http.SdkHttpClient;
61-
import software.amazon.awssdk.http.SdkHttpFullResponse;
6261
import software.amazon.awssdk.http.async.AsyncExecuteRequest;
6362
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
6463
import software.amazon.awssdk.utils.AttributeMap;
@@ -366,7 +365,7 @@ private NonManagedSdkHttpClient(SdkHttpClient delegate) {
366365
}
367366

368367
@Override
369-
public AbortableCallable<SdkHttpFullResponse> prepareRequest(ExecuteRequest request) {
368+
public InvokeableHttpRequest prepareRequest(ExecuteRequest request) {
370369
return delegate.prepareRequest(request);
371370
}
372371

core/sdk-core/src/main/java/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Optional;
2525
import java.util.TreeMap;
2626
import java.util.function.Consumer;
27-
import software.amazon.awssdk.annotations.SdkInternalApi;
2827
import software.amazon.awssdk.annotations.SdkPublicApi;
2928
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
3029
import software.amazon.awssdk.core.retry.RetryPolicy;
@@ -245,12 +244,8 @@ default Builder retryPolicy(Consumer<RetryPolicy.Builder> retryPolicy) {
245244
* <p>
246245
* This overrides any values currently configured in the builder.
247246
*
248-
* <p>
249-
* <b><i>This is currently an INTERNAL api, which means it is subject to change and should not be used.</i></b>
250-
*
251247
* @see ClientOverrideConfiguration#executionInterceptors()
252248
*/
253-
@SdkInternalApi
254249
Builder executionInterceptors(List<ExecutionInterceptor> executionInterceptors);
255250

256251
/**
@@ -262,12 +257,8 @@ default Builder retryPolicy(Consumer<RetryPolicy.Builder> retryPolicy) {
262257
* than the ones automatically added by the SDK. See {@link ExecutionInterceptor} for a more detailed explanation of
263258
* interceptor order.
264259
*
265-
* <p>
266-
* <b><i>This is currently an INTERNAL api, which means it is subject to change and should not be used.</i></b>
267-
*
268260
* @see ClientOverrideConfiguration#executionInterceptors()
269261
*/
270-
@SdkInternalApi
271262
Builder addExecutionInterceptor(ExecutionInterceptor executionInterceptor);
272263

273264
List<ExecutionInterceptor> executionInterceptors();

core/sdk-core/src/main/java/software/amazon/awssdk/core/interceptor/ExecutionInterceptor.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package software.amazon.awssdk.core.interceptor;
1717

18-
import software.amazon.awssdk.annotations.SdkProtectedApi;
18+
import software.amazon.awssdk.annotations.SdkPublicApi;
1919
import software.amazon.awssdk.core.SdkRequest;
2020
import software.amazon.awssdk.core.SdkResponse;
2121
// Disable CS to avoid "Unused Import" error. If we use the FQCN in the Javadoc, we'll run into line length issues instead.
@@ -26,6 +26,8 @@
2626
import software.amazon.awssdk.http.SdkHttpFullRequest;
2727
import software.amazon.awssdk.http.SdkHttpFullResponse;
2828

29+
30+
2931
/**
3032
* An interceptor that is invoked during the execution lifecycle of a request/response (execution). This can be used to publish
3133
* metrics, modify a request in-flight, debug request processing, view exceptions, etc. This interface exposes different methods
@@ -111,11 +113,8 @@
111113
* collection of attributes is created when a call to a service client is made and can be mutated throughout the course of the
112114
* client call. These attributes are made available to every interceptor hook and is available for storing data between method
113115
* calls. The SDK provides some attributes automatically, available via {@link SdkExecutionAttribute}.
114-
*
115-
* <p>
116-
* <b><i>Note: This interface will change between SDK versions and should not be implemented by SDK users.</i></b>
117116
*/
118-
@SdkProtectedApi
117+
@SdkPublicApi
119118
public interface ExecutionInterceptor {
120119
/**
121120
* Read a request that has been given to a service client before it is modified by other interceptors.

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/http/pipeline/stages/MakeHttpRequestStage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import software.amazon.awssdk.core.internal.http.InterruptMonitor;
2222
import software.amazon.awssdk.core.internal.http.RequestExecutionContext;
2323
import software.amazon.awssdk.core.internal.http.pipeline.RequestPipeline;
24-
import software.amazon.awssdk.http.AbortableCallable;
2524
import software.amazon.awssdk.http.ExecuteRequest;
25+
import software.amazon.awssdk.http.InvokeableHttpRequest;
2626
import software.amazon.awssdk.http.SdkHttpClient;
2727
import software.amazon.awssdk.http.SdkHttpFullRequest;
2828
import software.amazon.awssdk.http.SdkHttpFullResponse;
@@ -52,7 +52,7 @@ public Pair<SdkHttpFullRequest, SdkHttpFullResponse> execute(SdkHttpFullRequest
5252
}
5353

5454
private SdkHttpFullResponse executeHttpRequest(SdkHttpFullRequest request, RequestExecutionContext context) throws Exception {
55-
AbortableCallable<SdkHttpFullResponse> requestCallable = sdkHttpClient
55+
InvokeableHttpRequest requestCallable = sdkHttpClient
5656
.prepareRequest(ExecuteRequest.builder().request(request).build());
5757

5858
context.apiCallTimeoutTracker().abortable(requestCallable);

core/sdk-core/src/test/java/software/amazon/awssdk/core/client/handler/SyncClientHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
import software.amazon.awssdk.core.retry.RetryPolicy;
4646
import software.amazon.awssdk.core.runtime.transform.Marshaller;
4747
import software.amazon.awssdk.core.sync.ResponseTransformer;
48-
import software.amazon.awssdk.http.AbortableCallable;
4948
import software.amazon.awssdk.http.AbortableInputStream;
49+
import software.amazon.awssdk.http.InvokeableHttpRequest;
5050
import software.amazon.awssdk.http.SdkHttpClient;
5151
import software.amazon.awssdk.http.SdkHttpFullRequest;
5252
import software.amazon.awssdk.http.SdkHttpFullResponse;
@@ -69,7 +69,7 @@ public class SyncClientHandlerTest {
6969
private SdkHttpClient httpClient;
7070

7171
@Mock
72-
private AbortableCallable<SdkHttpFullResponse> httpClientCall;
72+
private InvokeableHttpRequest httpClientCall;
7373

7474
@Mock
7575
private HttpResponseHandler<SdkResponse> responseHandler;

core/sdk-core/src/test/java/software/amazon/awssdk/core/http/AmazonHttpClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
import software.amazon.awssdk.core.exception.SdkClientException;
3838
import software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient;
3939
import software.amazon.awssdk.core.internal.http.timers.ClientExecutionAndRequestTimerTestUtils;
40-
import software.amazon.awssdk.http.AbortableCallable;
4140
import software.amazon.awssdk.http.ExecuteRequest;
41+
import software.amazon.awssdk.http.InvokeableHttpRequest;
4242
import software.amazon.awssdk.http.SdkHttpClient;
4343
import software.amazon.awssdk.http.SdkHttpFullResponse;
4444
import utils.HttpTestUtils;
@@ -51,7 +51,7 @@ public class AmazonHttpClientTest {
5151
private SdkHttpClient sdkHttpClient;
5252

5353
@Mock
54-
private AbortableCallable<SdkHttpFullResponse> abortableCallable;
54+
private InvokeableHttpRequest abortableCallable;
5555

5656
private AmazonSyncHttpClient client;
5757

http-client-spi/src/main/java/software/amazon/awssdk/http/ExecuteRequest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@
2626
public final class ExecuteRequest {
2727

2828
private final SdkHttpFullRequest request;
29-
private final boolean isFullDuplex;
3029

3130
private ExecuteRequest(BuilderImpl builder) {
3231
this.request = builder.request;
33-
this.isFullDuplex = builder.isFullDuplex;
3432
}
3533

3634
/**
@@ -40,10 +38,6 @@ public SdkHttpFullRequest httpRequest() {
4038
return request;
4139
}
4240

43-
public boolean fullDuplex() {
44-
return isFullDuplex;
45-
}
46-
4741
public static Builder builder() {
4842
return new BuilderImpl();
4943
}
@@ -57,36 +51,18 @@ public interface Builder {
5751
*/
5852
Builder request(SdkHttpFullRequest request);
5953

60-
/**
61-
* Option to indicate if the request is for a full duplex operation ie., request and response are sent/received at
62-
* the same time.
63-
* <p>
64-
* This can be used to set http configuration like ReadTimeouts as soon as request has begin sending data instead of
65-
* waiting for the entire request to be sent.
66-
*
67-
* @return True if the operation this request belongs to is full duplex. Otherwise false.
68-
*/
69-
Builder fullDuplex(boolean fullDuplex);
70-
7154
ExecuteRequest build();
7255
}
7356

7457
private static class BuilderImpl implements Builder {
7558
private SdkHttpFullRequest request;
76-
private boolean isFullDuplex;
7759

7860
@Override
7961
public Builder request(SdkHttpFullRequest request) {
8062
this.request = request;
8163
return this;
8264
}
8365

84-
@Override
85-
public Builder fullDuplex(boolean fullDuplex) {
86-
isFullDuplex = fullDuplex;
87-
return this;
88-
}
89-
9066
@Override
9167
public ExecuteRequest build() {
9268
return new ExecuteRequest(this);

http-client-spi/src/main/java/software/amazon/awssdk/http/AbortableCallable.java renamed to http-client-spi/src/main/java/software/amazon/awssdk/http/InvokeableHttpRequest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515

1616
package software.amazon.awssdk.http;
1717

18+
import java.io.IOException;
1819
import java.util.concurrent.Callable;
19-
import software.amazon.awssdk.annotations.SdkProtectedApi;
20+
import software.amazon.awssdk.annotations.SdkPublicApi;
2021

2122
/**
22-
* Callable task that can be aborted.
23-
*
24-
* @param <T> Return type of task. May be {@link Void}.
23+
* An HTTP request that can be invoked by {@link #call()}. Once invoked, the HTTP call can be cancelled via {@link #abort()},
24+
* which should release the thread that has invoked {@link #call()} as soon as possible.
2525
*/
26-
@SdkProtectedApi
27-
public interface AbortableCallable<T> extends Callable<T>, Abortable {
28-
26+
@SdkPublicApi
27+
public interface InvokeableHttpRequest extends Callable<SdkHttpFullResponse>, Abortable {
28+
@Override
29+
SdkHttpFullResponse call() throws IOException;
2930
}

http-client-spi/src/main/java/software/amazon/awssdk/http/SdkHttpClient.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package software.amazon.awssdk.http;
1717

1818
import software.amazon.awssdk.annotations.Immutable;
19-
import software.amazon.awssdk.annotations.SdkProtectedApi;
19+
import software.amazon.awssdk.annotations.SdkPublicApi;
2020
import software.amazon.awssdk.annotations.ThreadSafe;
2121
import software.amazon.awssdk.utils.AttributeMap;
2222
import software.amazon.awssdk.utils.SdkAutoCloseable;
@@ -26,20 +26,18 @@
2626
* Interface to take a representation of an HTTP request, make an HTTP call, and return a representation of an HTTP response.
2727
*
2828
* <p>Implementations MUST be thread safe.</p>
29-
*
30-
* <p><b><i>Note: This interface will change between SDK versions and should not be implemented by SDK users.</i></b></p>
3129
*/
3230
@Immutable
3331
@ThreadSafe
34-
@SdkProtectedApi
32+
@SdkPublicApi
3533
public interface SdkHttpClient extends SdkAutoCloseable {
3634
/**
37-
* Create a {@link AbortableCallable} that can be used to execute the HTTP request.
35+
* Create a {@link InvokeableHttpRequest} that can be used to execute the HTTP request.
3836
*
3937
* @param request Representation of an HTTP request.
4038
* @return Task that can execute an HTTP request and can be aborted.
4139
*/
42-
AbortableCallable<SdkHttpFullResponse> prepareRequest(ExecuteRequest request);
40+
InvokeableHttpRequest prepareRequest(ExecuteRequest request);
4341

4442
/**
4543
* Interface for creating an {@link SdkHttpClient} with service specific defaults applied.

http-client-spi/src/main/java/software/amazon/awssdk/http/SdkHttpService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package software.amazon.awssdk.http;
1717

18-
import software.amazon.awssdk.annotations.SdkProtectedApi;
18+
import software.amazon.awssdk.annotations.SdkPublicApi;
1919
import software.amazon.awssdk.annotations.ThreadSafe;
2020

2121
/**
@@ -31,7 +31,7 @@
3131
* </p>
3232
*/
3333
@ThreadSafe
34-
@SdkProtectedApi
34+
@SdkPublicApi
3535
public interface SdkHttpService {
3636

3737
/**

http-client-spi/src/main/java/software/amazon/awssdk/http/async/AbortableRunnable.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

http-client-spi/src/main/java/software/amazon/awssdk/http/async/AsyncExecuteRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
package software.amazon.awssdk.http.async;
1717

18-
import software.amazon.awssdk.annotations.SdkProtectedApi;
18+
import software.amazon.awssdk.annotations.SdkPublicApi;
1919
import software.amazon.awssdk.http.SdkHttpRequest;
2020

2121
/**
2222
* Request object containing the parameters necessary to make an asynchronous HTTP request.
2323
*
2424
* @see SdkAsyncHttpClient
2525
*/
26-
@SdkProtectedApi
26+
@SdkPublicApi
2727
public final class AsyncExecuteRequest {
2828
private final SdkHttpRequest request;
2929
private final SdkHttpContentPublisher requestContentPublisher;

http-client-spi/src/main/java/software/amazon/awssdk/http/async/SdkAsyncHttpClient.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
package software.amazon.awssdk.http.async;
1717

1818
import java.util.concurrent.CompletableFuture;
19-
2019
import software.amazon.awssdk.annotations.Immutable;
21-
import software.amazon.awssdk.annotations.SdkProtectedApi;
20+
import software.amazon.awssdk.annotations.SdkPublicApi;
2221
import software.amazon.awssdk.annotations.ThreadSafe;
2322
import software.amazon.awssdk.utils.AttributeMap;
2423
import software.amazon.awssdk.utils.SdkAutoCloseable;
@@ -29,12 +28,10 @@
2928
* HTTP response.
3029
*
3130
* <p>Implementations MUST be thread safe.</p>
32-
*
33-
* <p><b><i>Note: This interface will change between SDK versions and should not be implemented by SDK users.</i></b></p>
3431
*/
3532
@Immutable
3633
@ThreadSafe
37-
@SdkProtectedApi
34+
@SdkPublicApi
3835
public interface SdkAsyncHttpClient extends SdkAutoCloseable {
3936

4037
/**

http-client-spi/src/main/java/software/amazon/awssdk/http/async/SdkAsyncHttpService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
package software.amazon.awssdk.http.async;
1717

18-
import software.amazon.awssdk.annotations.SdkProtectedApi;
18+
import software.amazon.awssdk.annotations.SdkPublicApi;
1919
import software.amazon.awssdk.annotations.ThreadSafe;
2020

2121
/**
@@ -31,7 +31,7 @@
3131
* </p>
3232
*/
3333
@ThreadSafe
34-
@SdkProtectedApi
34+
@SdkPublicApi
3535
public interface SdkAsyncHttpService {
3636

3737
/**

0 commit comments

Comments
 (0)