-
Notifications
You must be signed in to change notification settings - Fork 970
ProfileFileSupplier API changes, aggregating #3558
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
ProfileFileSupplier API changes, aggregating #3558
Conversation
| currentValuesBySupplier.keySet().forEach(ProfileFileSupplier::close); | ||
| } | ||
|
|
||
| private boolean updateCurrentValue(ProfileFileSupplier supplier, Consumer<ProfileFile> action) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe updateCurrentValue might not be the most accurate name for this method? It seems to also check if the supplier provided a modified ProfileFile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I'll have to think hard to try to come up with an appropriate name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method has been removed as it was not needed as pointed out in other comment.
| "category": "AWS SDK for Java v2", | ||
| "contributor": "", | ||
| "type": "feature", | ||
| "description": "Add methods to ProfileFileSupplier for aggregating" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we haven't merged the APIs to mainline yet, you don't need a changelog entry for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| ProfileFile current = currentValuesBySupplier.put(supplier, next); | ||
| action.accept(next); | ||
|
|
||
| return !Objects.equals(next, current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks seem redundant. The contract of the API is that ProfileFileSupplier#get should return the same object if it's not updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Entire method has been removed.
| private ProfileFile refreshAndGetCurrentAggregate(ProfileFile.Aggregator aggregator) { | ||
| ProfileFile next = aggregator.build(); | ||
| if (isNewAggregateProfileFile(next)) { | ||
| currentAggregateProfileFile = next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that need to be thread safe? Do we need to use compare and set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used same pattern in other classes, for example ProfileFileRefresher. Interested to hear what @dagnir has to say, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we do; we want want to ensure that next does not change between lines 148 and 149. Good eye @L-Applin!
If the CAS fails, I think it's fine since that would mean a different thread already updated it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed type of reference.
|
SonarCloud Quality Gate failed. |
* ProfileCredentialsProvider can now reload credentials when profile files change (#3487) * ProfileFile can update if disk changed, reload as new instance * ProfileCredentialsProvider reloads credentials if profile file has changes * Created class ProfileFileRefresher * Created ReloadingProfileCredentialsProvider; moved new logic in ProfileFile to ProfileFileRefresher * Fix ReloadingProfileCredentialsBehavior when missing ProfileFile Supplier or Predicate, and dealing with defaults * Consolidated ReloadingProfileCredentialsProvider functionality into ProfileCredentialsProvider * Fix behavior when dealing with defaults * Created ProfileFileSupplier interface; refactored * Misc fixes * Created package-private ProfileFileSupplierBuilder; ProfileFileSupplier now extends Supplier; Fixed Javadoc * Fixed unit tests for default credentials file * Removed ProfileFileSupplier.Builder interface * Code cleanup * ProfileFileSupplier API changes, aggregating (#3558) * Added methods for aggregating ProfileFile objects * Removed redundant logic, changelog entry * Removed redundant methods * Use compare and set to make thread safe * DefaultCredentialsProvider reload profile (#3580) * Misc fixes * Reload credentials by DefaultCredentialsProvider; pass supplier to InstanceProfileCredentialsProvider * Fix code alignment * Update public APIs to Supplier<ProfileFile> instead of ProfileFileSupplier (#3607) * ProfileTokenProvider Reload ProfileFile (#3608) * Updated ProfileTokenProvider * Updated tests, do not explicitly swallow exceptions * ProfileTokenProviderLoader can use Supplier<Profilefile> internally * Simplified ProfileTokenProviderLoader API; implemented synchronized block * Use synchronized block (#3646) * S3 support classes take Supplier<ProfileFile> (#3653) * S3 support classes take Supplier<ProfileFile> * Review comments * Presigners, other Support classes take Supplier<ProfileFile> (#3677) * Presigners, other Support classes take Supplier<ProfileFile> * Split new ProfileFile tests from existing parameterized tests * Improved tests readability * ProfileFile updates to BaseClientBuilderClass, other S3 classes (#3685) * Leverage SdkClientOption and SdkExecutionAttributes; fallback to simp… (#3692) * Leverage SdkClientOption and SdkExecutionAttributes; fallback to simple ProfileFile * Addressed review comments * Updated changelog entry (#3699) * Fixed review comments * Removed unnecessary logic * Deprecated SdkClientOption PROFILE_FILE * Deprecated SdkExecutionAttribute PROFILE_FILE * Updated changelog entry









Motivation and Context
Update the
ProfileFileSupplierAPI to include methods for aggregating multipleProfileFileobjects into a singleProfileFileSupplier. This will mimic how multipleProfileFilecan be aggregated into anotherProfileFileobject.This change is in preparation for adding reloading functionality to
DefaultCredentialsProvider.Modifications
Revised 2 methods and added 4 methods to
ProfileFileSupplier.Testing
Added unit tests.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License