[Fix] Make UserAgent
's otherInfo
thread-safe
#357
Merged
+220
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
UserAgent.asString()
is called byApiClient
every time a request is made.UserAgent
contains anotherInfo
list of additional metadata that users can add to the user agent as needed. If users concurrently modify thisotherInfo
value while iterating through it when making a request,ConcurrentModificationException
is thrown.To prevent this, we add
synchronized
blocks around modifying and reading fromotherInfo
. Since the time spent constructing the user agent is generally fast, this should not significantly affect performance.I also added a readme describing the new benchmark module with a small contribution guide, and I renamed the existing load test to align with that contribution guide.
Tests
Added a
UserAgentLoadTest
to validate that you can safely add tootherInfo
and make requests.Added a
WorkspaceClientLoadIT
to exercise the SDK end-to-end with the SCIM Me request, concurrently.