Skip to content

Commit

Permalink
Use AsyncRequestBody.fromByteBufferUnsafe and drop custom implementation
Browse files Browse the repository at this point in the history
It was introduced in SDK v2 2.20.84 by aws/aws-sdk-java-v2#3925
  • Loading branch information
wendigo committed Jun 21, 2023
1 parent 7d308de commit 87e9678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 118 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
import static java.util.Objects.requireNonNull;
import static java.util.Objects.requireNonNullElseGet;
import static java.util.concurrent.TimeUnit.SECONDS;
import static software.amazon.awssdk.core.async.AsyncRequestBody.fromByteBufferUnsafe;
import static software.amazon.awssdk.core.client.config.SdkAdvancedClientOption.USER_AGENT_PREFIX;
import static software.amazon.awssdk.core.client.config.SdkAdvancedClientOption.USER_AGENT_SUFFIX;

Expand Down Expand Up @@ -712,7 +713,7 @@ public ListenableFuture<Void> write(Slice slice)
.key(key)
.storageClass(storageClass);
directUploadFuture = translateFailures(toListenableFuture(s3AsyncClient.putObject(putObjectRequestBuilder.build(),
ByteBufferAsyncRequestBody.fromByteBuffer(slice.toByteBuffer()))));
fromByteBufferUnsafe(slice.toByteBuffer()))));
stats.getPutObject().record(directUploadFuture);
stats.getPutObjectDataSizeInBytes().add(slice.length());
return directUploadFuture;
Expand Down Expand Up @@ -804,7 +805,7 @@ private ListenableFuture<CompletedPart> uploadPart(String uploadId, Slice slice,
.partNumber(partNumber);
UploadPartRequest uploadPartRequest = uploadPartRequestBuilder.build();
stats.getUploadPartDataSizeInBytes().add(slice.length());
return stats.getUploadPart().record(Futures.transform(toListenableFuture(s3AsyncClient.uploadPart(uploadPartRequest, ByteBufferAsyncRequestBody.fromByteBuffer(slice.toByteBuffer()))),
return stats.getUploadPart().record(Futures.transform(toListenableFuture(s3AsyncClient.uploadPart(uploadPartRequest, fromByteBufferUnsafe(slice.toByteBuffer()))),
uploadPartResponse -> CompletedPart.builder().eTag(uploadPartResponse.eTag()).partNumber(partNumber).build(), directExecutor()));
}

Expand Down

0 comments on commit 87e9678

Please sign in to comment.