Skip to content

Performance improvements #4850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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