Skip to content

Commit

Permalink
Performance improvements (#4850)
Browse files Browse the repository at this point in the history
  • Loading branch information
millems committed Jan 26, 2024
1 parent ce49ac7 commit 5e3e0ce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changes/next-release/bugfix-AWSSDKforJavav2-8b416ff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Fixed bug where the ProfileCredentialsProvider would re-read the credentials file with each request by default."
}
6 changes: 6 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-9014236.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "feature",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Improved performance of chunk-encoded streaming uploads, like S3's PutObject."
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ private ProfileCredentialsProvider(BuilderImpl builder) {
try {
selectedProfileName = Optional.ofNullable(builder.profileName)
.orElseGet(ProfileFileSystemSetting.AWS_PROFILE::getStringValueOrThrow);

selectedProfileSupplier = Optional.ofNullable(builder.profileFile)
.orElseGet(() -> builder.defaultProfileFileLoader);
selectedProfileSupplier =
Optional.ofNullable(builder.profileFile)
.orElseGet(() -> ProfileFileSupplier.fixedProfileFile(builder.defaultProfileFileLoader.get()));

} catch (RuntimeException e) {
// If we couldn't load the credentials provider for some reason, save an exception describing why. This exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,20 @@ public static Builder builder() {

@Override
public int read() throws IOException {
return currentChunk().stream().read();
}

@Override
public int read(byte[] b, int off, int len) throws IOException {
return currentChunk().stream().read(b, off, len);
}

private Chunk currentChunk() throws IOException {
if (currentChunk == null || !currentChunk.hasRemaining() && !isFinished) {
currentChunk = getChunk(inputStream);
}

return currentChunk.stream().read();
return currentChunk;
}

/**
Expand Down

0 comments on commit 5e3e0ce

Please sign in to comment.