Skip to content

Commit 10c41da

Browse files
committed
Improve documentation + more cleanups
1 parent 4302b8d commit 10c41da

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

services-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/GenericS3TransferManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,13 @@ public FileUpload uploadFile(UploadFileRequest uploadFileRequest) {
215215
TransferProgressUpdater progressUpdater = new TransferProgressUpdater(uploadFileRequest,
216216
requestBody.contentLength().orElse(null));
217217
progressUpdater.transferInitiated();
218-
boolean multipartEnabled = isS3ClientMultipartEnabled();
219218
requestBody = progressUpdater.wrapRequestBody(requestBody, false);
220219

221220
progressUpdater.registerCompletion(returnFuture);
222221

223222
PutObjectRequest putObjectRequest = uploadFileRequest.putObjectRequest();
224223
PauseObservable pauseObservable;
225-
if (multipartEnabled) {
224+
if (isS3ClientMultipartEnabled()) {
226225
pauseObservable = new PauseObservable();
227226
Consumer<AwsRequestOverrideConfiguration.Builder> attachObservableAndListener =
228227
b -> b.putExecutionAttribute(PAUSE_OBSERVABLE, pauseObservable)

services-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/progress/TransferListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@
7272
* <li>Be mindful that {@link #bytesTransferred(Context.BytesTransferred)} may be called extremely often (subject to I/O
7373
* buffer sizes). Be careful in implementing expensive operations as a side effect. Consider rate-limiting your side
7474
* effect operations, if needed.</li>
75-
* <li>In the case of uploads, there may be some delay between the bytes being fully transferred and the transfer
75+
* <li>In the case of multipart uploads, there may be some delay between the bytes being fully transferred and the transfer
7676
* successfully completing. Internally, {@link S3TransferManager} uses the Amazon S3
7777
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html">multipart upload API</a>
7878
* and must finalize uploads with a {@link CompleteMultipartUploadRequest}.</li>
79+
* <li>For single part in-memory uploads, 100% of the bytes are read immediately into memory and progress is only
80+
* reported once, after all bytes are sent and the HTTP response is received.</li>
81+
* <li>For single part file uploads, progress is reported when bytes are read from the file rather than when bytes are sent
82+
* so there will be some delay between when progress reaching 100% and the transfer successfully completing.</li>
7983
* <li>{@link TransferListener}s may be invoked by different threads. If your {@link TransferListener} is stateful,
8084
* ensure that it is also thread-safe.</li>
8185
* <li>{@link TransferListener}s are not intended to be used for control flow, and therefore your implementation

services-custom/s3-transfer-manager/src/test/java/software/amazon/awssdk/transfer/s3/internal/TransferProgressUpdaterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public void exceptionOccurred(Throwable error) {
256256

257257

258258
@Test
259-
void wrapRequestBody_suppressProgress_doesNotReportProgress() {
259+
void wrapRequestBody_disableIncrementalProgress_doesNotReportProgress() {
260260
byte[] data = new byte[1024];
261261
Arrays.fill(data, (byte) 'a');
262262
long contentLength = data.length;
@@ -293,7 +293,7 @@ public void onComplete() {
293293
}
294294
});
295295

296-
// When suppressProgress is true, the wrapper should NOT report any progress.
296+
// When disableIncrementalProgress is true, the wrapper should NOT report any progress.
297297
// Progress is instead reported by the JAVA_PROGRESS_LISTENER after the server responds.
298298
assertThat(bytesAfterOnNext.get()).isNotNull();
299299
assertThat(bytesAfterOnNext.get()).isEqualTo(0L);

0 commit comments

Comments
 (0)