Skip to content

Commit c381f8a

Browse files
committed
Revert "Use maximumBufferSize in ByteArraySplittingTransformer"
This reverts commit 1d136e5.
1 parent 1d136e5 commit c381f8a

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/ByteArrayAsyncResponseTransformer.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
2929
import software.amazon.awssdk.core.async.SdkPublisher;
3030
import software.amazon.awssdk.utils.BinaryUtils;
31-
import software.amazon.awssdk.utils.Validate;
32-
import software.amazon.awssdk.utils.async.DelegatingBufferingSubscriber;
3331

3432
/**
3533
* Implementation of {@link AsyncResponseTransformer} that dumps content into a byte array and supports further
@@ -63,24 +61,16 @@ public void onStream(SdkPublisher<ByteBuffer> publisher) {
6361
publisher.subscribe(new BaosSubscriber(cf));
6462
}
6563

66-
public void onStream(SdkPublisher<ByteBuffer> publisher, long maximumBufferSize) {
67-
publisher.subscribe(DelegatingBufferingSubscriber.builder()
68-
.maximumBufferInBytes(maximumBufferSize)
69-
.delegate(new BaosSubscriber(cf))
70-
.build());
71-
}
72-
7364
@Override
7465
public void exceptionOccurred(Throwable throwable) {
7566
cf.completeExceptionally(throwable);
7667
}
7768

7869
@Override
7970
public SplitResult<ResponseT, ResponseBytes<ResponseT>> split(SplittingTransformerConfiguration splitConfig) {
80-
Validate.notNull(splitConfig, "splitConfig must not be null");
8171
CompletableFuture<ResponseBytes<ResponseT>> future = new CompletableFuture<>();
8272
SdkPublisher<AsyncResponseTransformer<ResponseT, ResponseT>> transformer =
83-
new ByteArraySplittingTransformer<>(this, future, splitConfig.bufferSizeInBytes());
73+
new ByteArraySplittingTransformer<>(this, future);
8474
return AsyncResponseTransformer.SplitResult.<ResponseT, ResponseBytes<ResponseT>>builder()
8575
.publisher(transformer)
8676
.resultFuture(future)

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/ByteArraySplittingTransformer.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import software.amazon.awssdk.core.exception.SdkClientException;
3535
import software.amazon.awssdk.utils.CompletableFutureUtils;
3636
import software.amazon.awssdk.utils.Logger;
37-
import software.amazon.awssdk.utils.Validate;
3837
import software.amazon.awssdk.utils.async.SimplePublisher;
3938

4039
@SdkInternalApi
@@ -74,18 +73,9 @@ public class ByteArraySplittingTransformer<ResponseT> implements SdkPublisher<As
7473

7574
private final Map<Integer, ByteBuffer> buffers;
7675

77-
/**
78-
* The buffer size used to buffer the content received from the downstream subscriber
79-
*/
80-
private final long maximumBufferInBytes;
81-
8276
public ByteArraySplittingTransformer(AsyncResponseTransformer<ResponseT, ResponseBytes<ResponseT>>
8377
upstreamResponseTransformer,
84-
CompletableFuture<ResponseBytes<ResponseT>> resultFuture,
85-
Long maximumBufferSizeInBytes) {
86-
Validate.notNull(maximumBufferSizeInBytes, "maximumBufferSizeInBytes");
87-
this.maximumBufferInBytes = Validate.isPositive(
88-
maximumBufferSizeInBytes, "maximumBufferSizeInBytes");
78+
CompletableFuture<ResponseBytes<ResponseT>> resultFuture) {
8979
this.upstreamResponseTransformer = upstreamResponseTransformer;
9080
this.resultFuture = resultFuture;
9181
this.buffers = new ConcurrentHashMap<>();
@@ -233,7 +223,7 @@ public void onResponse(ResponseT response) {
233223

234224
@Override
235225
public void onStream(SdkPublisher<ByteBuffer> publisher) {
236-
delegate.onStream(publisher, maximumBufferInBytes);
226+
delegate.onStream(publisher);
237227
synchronized (lock) {
238228
if (!onStreamCalled) {
239229
onStreamCalled = true;

services/s3/src/main/java/software/amazon/awssdk/services/s3/multipart/MultipartConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ public Long minimumPartSizeInBytes() {
9090

9191
/**
9292
* The maximum memory, in bytes, that the SDK will use to buffer requests content into memory.
93+
* <p>
94+
* This setting is not supported and will be ignored when downloading to a byte array, i.e., when providing a
95+
* {@link ByteArrayAsyncResponseTransformer}.
96+
*
9397
* @return the value of the configured maximum memory usage.
9498
*/
9599
public Long apiCallBufferSizeInBytes() {
@@ -159,6 +163,9 @@ public interface Builder extends CopyableBuilder<Builder, MultipartConfiguration
159163
* Increasing this value may lead to better performance at the cost of using more memory.
160164
* <p>
161165
* Default value: If not specified, the SDK will use the equivalent of four parts worth of memory, so 32 Mib by default.
166+
* <p>
167+
* This setting is not supported and will be ignored when downloading to a byte array, i.e., when providing a
168+
* {@link ByteArrayAsyncResponseTransformer}.
162169
*
163170
* @param apiCallBufferSizeInBytes the value of the maximum memory usage.
164171
* @return an instance of this builder.

0 commit comments

Comments
 (0)