KNOX-2233 - DefaultKeystoreService getCredentialForCluster uses cache…#264
Merged
pzampino merged 1 commit intoapache:masterfrom Feb 12, 2020
Merged
KNOX-2233 - DefaultKeystoreService getCredentialForCluster uses cache…#264pzampino merged 1 commit intoapache:masterfrom
pzampino merged 1 commit intoapache:masterfrom
Conversation
… without synchronization
moresandeep
reviewed
Feb 12, 2020
| addToCache(clusterName, alias, credentialString); | ||
| char[] credential; | ||
|
|
||
| synchronized (this) { |
Contributor
There was a problem hiding this comment.
Instead of synchronizing the whole block wouldn't it be better to add something like a ReadWriteLock ?
Contributor
Author
There was a problem hiding this comment.
The intention here is to complete the existing synchronization pattern. More drastic changes merit a separate JIRA IMO.
stoty
pushed a commit
to stoty/knox
that referenced
this pull request
May 14, 2024
… without synchronization (apache#264) Change-Id: I4a5949df9694fcb8ce2b3580cf8aeaafc777a4b1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
… without synchronization
What changes were proposed in this pull request?
Added synchronization to getCredentialForCluster(String, String) since it uses/updates the cache (e.g., checkCache(String, String), addToCache(String, String, String)). At a minimum, this avoids potential repeated unnecessary keystore file accesses for the same alias.
How was this patch tested?
Performed some manual testing, but since the overall behavior should not change, ran all existing tests as validation.